woj-server/Runner.Dockerfile

38 lines
945 B
Docker
Raw Normal View History

2023-07-15 18:14:50 +08:00
# builder
2023-08-11 18:54:00 +08:00
FROM docker.io/library/golang:alpine AS builder
2023-07-15 18:14:50 +08:00
#ENV GOPROXY=https://goproxy.cn
2023-12-23 16:42:21 +08:00
ENV CGO_ENABLED=0
2023-07-15 18:14:50 +08:00
WORKDIR /builder
RUN apk add --no-cache git make
RUN go install github.com/swaggo/swag/cmd/swag@latest
2023-07-15 18:14:50 +08:00
ARG IMAGE_PREFIX=git.0x7f.app/woj
ENV CONTAINER_IMAGE_FULL=${IMAGE_PREFIX}/ubuntu-full:latest
ENV CONTAINER_IMAGE_RUN=${IMAGE_PREFIX}/ubuntu-run:latest
2023-07-15 18:14:50 +08:00
COPY go.mod /builder/go.mod
COPY go.sum /builder/go.sum
RUN go mod download
2023-07-15 18:14:50 +08:00
COPY . /builder
RUN make build
2023-07-15 18:14:50 +08:00
# main image
2024-01-27 19:11:26 +08:00
FROM docker.io/library/alpine
2023-07-15 18:14:50 +08:00
WORKDIR /app
RUN apk --no-cache add tzdata ca-certificates bash tini \
2024-01-27 19:11:26 +08:00
containerd nerdctl
2023-07-15 18:14:50 +08:00
2023-08-11 18:54:00 +08:00
# sources
2024-01-27 19:11:26 +08:00
COPY --from=builder /builder/resource/runner /app/resource/runner
2023-08-11 18:54:00 +08:00
COPY --from=builder /builder/config.docker.yaml /app
COPY --from=builder /builder/docker-entrypoint.sh /app
2023-07-15 18:14:50 +08:00
COPY --from=builder /builder/woj /app
# reap zombies from containerd-shim
ENTRYPOINT ["/sbin/tini", "/app/docker-entrypoint.sh"]