-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12bf505
commit 9a1faac
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,16 @@ COPY init_portainer.go / | |
RUN go build -o init_portainer /init_portainer.go | ||
RUN chmod +x /init_portainer | ||
|
||
#COPY environment.go / | ||
#RUN go build -o environment /environment.go | ||
#RUN chmod +x /environment | ||
|
||
# step2: Copy build go program to portainer | ||
# Dockerfile refer to: https://github.com/portainer/portainer/blob/develop/build/linux/Dockerfile | ||
FROM portainer/portainer-ce:2.19.0 | ||
LABEL maintainer="websoft9<[email protected]>" | ||
LABEL version="2.19.0" | ||
COPY --from=builder /init_portainer / | ||
#COPY --from=builder /environment / | ||
|
||
ENTRYPOINT ["/init_portainer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#### go code below | ||
|
||
package main | ||
|
||
#1 wait and get credential | ||
#2 portainer api login | ||
#3 add local if not exist | ||
``` | ||
name: local | ||
url: /var/run/docker.sock | ||
``` | ||
|
||
|
||
curl -X POST -H "Content-Type: application/json" -d '{"username":"admin", "Password":"'$new_password'"}' http://$portainer_ip:9000/api/users/admin/init | ||
curl "http://$appmanage_ip:5000/AppUpdateUser?user_name=admin&password=$new_password" | ||
|
||
|
||
|
||
#### other place | ||
|
||
- add it to Dockerfile | ||
- docker compose health check | ||
|
||
``` | ||
healthcheck: | ||
test: ["CMD", "/healthcheck"] | ||
interval: 1m30s | ||
timeout: 10s | ||
retries: 3 | ||
``` |