From 0220641c0caaa0ba842c4e24eb0f4b2d67d813b1 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Fri, 6 Dec 2024 16:11:04 +0800 Subject: [PATCH] websoft9 --- docker/deployment/Dockerfile | 2 +- docker/deployment/init_portainer.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker/deployment/Dockerfile b/docker/deployment/Dockerfile index 3def5606..0610104c 100644 --- a/docker/deployment/Dockerfile +++ b/docker/deployment/Dockerfile @@ -13,7 +13,7 @@ RUN chmod +x /init_portainer # Dockerfile refer to: https://github.com/portainer/portainer/blob/develop/build/linux/Dockerfile FROM portainer/portainer-ce:2.20.3 LABEL maintainer="websoft9" -LABEL version="2.20.3" +LABEL version="2.20.3-rc1" COPY --from=builder /init_portainer / ENTRYPOINT ["/init_portainer"] \ No newline at end of file diff --git a/docker/deployment/init_portainer.go b/docker/deployment/init_portainer.go index 3998d5b2..3c0e16ae 100644 --- a/docker/deployment/init_portainer.go +++ b/docker/deployment/init_portainer.go @@ -31,9 +31,12 @@ type Credentials struct { } func main() { - // 检查初始化标志文件是否存在 - if _, err := os.Stat(initFlagFilePath); err == nil { - log.Println("Initialization has already been completed by another instance.") + + initFlagExists := fileExists(initFlagFilePath) + credentialFileExists := fileExists(credentialFilePath) + + if initFlagExists || credentialFileExists { + log.Println("Initialization has already been completed by another instance or credentials are present.") startPortainer() return }