websoft9/docker/w9portainer/docker-compose.yml
2023-09-06 11:47:18 +08:00

32 lines
832 B
YAML

version: "3.8"
services:
portainer:
container_name: ${APP_NAME}
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
volumes:
- portainer:/data
- /var/run/docker.sock:/var/run/docker.sock
ports:
- ${APP_HTTP_PORT}:9000
networks:
default:
name: ${APP_NETWORK}
external: true
volumes:
portainer: