deploy image upload to dockerhub

This commit is contained in:
qiaofeng1227 2023-09-18 09:31:29 +08:00
parent 1db322c8f6
commit 011a85368e
3 changed files with 11 additions and 7 deletions

View File

@ -7,6 +7,6 @@ RUN chmod +x /init_portainer
# step2: copy build go program to portainer
FROM portainer/portainer-ce:2.19.0
LABEL maintainer="Websoft9<help@websoft9.com>"
LABEL maintainer="websoft9<help@websoft9.com>"
LABEL version="2.19.0"
COPY --from=builder /init_portainer /

View File

@ -6,9 +6,6 @@ services:
portainer:
container_name: websoft9-deploy
image: websoft9dev/deploy:2.19.0
build:
context: .
dockerfile: Dockerfile
entrypoint: ["/init_portainer"]
restart: unless-stopped
volumes:

View File

@ -10,7 +10,7 @@ import (
)
func main() {
filePath := "/portainer_password"
filePath := "/var/websoft9/portainer_password"
_, err := os.Stat(filePath)
if os.IsNotExist(err) {
@ -56,6 +56,13 @@ func generatePassword(length int) string {
return string(password)
}
func writeToFile(filename, content string) error {
return ioutil.WriteFile(filename, []byte(content), 0755)
func writeToFile(filePath , content string) error {
if _, err := os.Stat(filePath); os.IsNotExist(err) {
err = os.MkdirAll(filePath, 0755)
if err != nil {
fmt.Println(err)
return
}
}
return ioutil.WriteFile(filePath , []byte(content), 0755)
}