websoft9/docker/w9portainer/docker-compose.yml

32 lines
832 B
YAML
Raw Normal View History

2023-04-20 17:11:36 +08:00
version: "3.8"
services:
2023-09-06 11:47:18 +08:00
2023-04-20 17:11:36 +08:00
portainer:
container_name: ${APP_NAME}
2023-09-06 11:47:18 +08:00
build:
context: .
dockerfile_inline: |
# step1: build entrypoint execute program init_portainer by golang
FROM golang:latest AS builder
WORKDIR /
COPY init_portainer.go /init_portainer.go
RUN go build -o init_portainer init_portainer.go
RUN chmod +x ./init_portainer
# step2: copy build go program to portainer
FROM portainer/portainer-ce:${APP_VERSION}
COPY --from=builder /init_portainer /
entrypoint: ["/init_portainer"]
restart: unless-stopped
2023-04-20 17:11:36 +08:00
volumes:
- portainer:/data
- /var/run/docker.sock:/var/run/docker.sock
2023-07-20 08:32:33 +08:00
ports:
- ${APP_HTTP_PORT}:9000
2023-04-20 17:11:36 +08:00
networks:
default:
name: ${APP_NETWORK}
external: true
volumes:
2023-09-06 11:47:18 +08:00
portainer: