websoft9/docker/deployment/Dockerfile

24 lines
805 B
Text
Raw Permalink Normal View History

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