From 5528e054cd2a3b6bac107121b45f9f1c176d21f1 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Fri, 6 Dec 2024 16:29:20 +0800 Subject: [PATCH] portainer --- docker/deployment/Dockerfile | 2 +- docker/deployment/init_portainer.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docker/deployment/Dockerfile b/docker/deployment/Dockerfile index 0610104c..fd171b60 100644 --- a/docker/deployment/Dockerfile +++ b/docker/deployment/Dockerfile @@ -1,4 +1,4 @@ -# modify time: 202407291102, you can modify here to trigger Docker Build action +# modify time: 202412061629, you can modify here to trigger Docker Build action # step1: Build entrypoint execute program init_portainer by golang FROM golang:latest AS builder diff --git a/docker/deployment/init_portainer.go b/docker/deployment/init_portainer.go index 3c0e16ae..49410ede 100644 --- a/docker/deployment/init_portainer.go +++ b/docker/deployment/init_portainer.go @@ -31,7 +31,7 @@ type Credentials struct { } func main() { - + // 检查初始化标志文件是否存在 initFlagExists := fileExists(initFlagFilePath) credentialFileExists := fileExists(credentialFilePath) @@ -82,6 +82,13 @@ func main() { } } +func fileExists(filePath string) bool { + if _, err := os.Stat(filePath); err == nil { + return true + } + return false +} + func startPortainer() { cmd := exec.Command("/portainer") cmd.Stdout = os.Stdout