websoft9/docker/deployment/Dockerfile

24 lines
805 B
Docker
Raw Normal View History

2023-11-03 16:06:27 +08:00
# modify time: 202311031633, you can modify here to trigger Docker Build action
2023-10-17 17:42:38 +08:00
# step1: Build entrypoint execute program init_portainer by golang
2023-10-18 16:58:47 +08:00
2023-09-11 08:40:56 +08:00
FROM golang:latest AS builder
WORKDIR /
2023-09-11 16:51:48 +08:00
COPY init_portainer.go /
2023-10-19 18:31:27 +08:00
# CGO_ENABLED=0 can not depend on any dynamic library
2023-10-19 18:16:59 +08:00
RUN CGO_ENABLED=0 go build -o init_portainer /init_portainer.go
2023-09-13 08:38:24 +08:00
RUN chmod +x /init_portainer
2023-09-11 08:40:56 +08:00
2023-10-19 17:45:17 +08:00
COPY endpoint.go /
2023-10-19 18:16:59 +08:00
RUN CGO_ENABLED=0 go build -o endpoint /endpoint.go
2023-10-19 17:45:17 +08:00
RUN chmod +x /endpoint
2023-10-18 17:21:53 +08:00
2023-10-17 17:42:38 +08:00
# step2: Copy build go program to portainer
2023-10-17 14:42:09 +08:00
# Dockerfile refer to: https://github.com/portainer/portainer/blob/develop/build/linux/Dockerfile
2023-09-11 08:40:56 +08:00
FROM portainer/portainer-ce:2.19.0
2023-09-18 09:31:29 +08:00
LABEL maintainer="websoft9<help@websoft9.com>"
2023-09-18 09:01:53 +08:00
LABEL version="2.19.0"
2023-09-19 16:28:36 +08:00
COPY --from=builder /init_portainer /
2023-10-19 17:45:17 +08:00
COPY --from=builder /endpoint /
2023-09-23 10:41:35 +08:00
2023-10-18 19:57:35 +08:00
ENTRYPOINT ["/init_portainer"]