Dockerfile 695 B

123456789101112131415161718192021222324
  1. ARG GO_VERSION=1.18
  2. FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build
  3. ARG TARGETOS
  4. ARG TARGETARCH
  5. WORKDIR /build
  6. COPY . .
  7. RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -ldflags "-s -w -extldflags '-static'" && \
  8. echo "skunkyart:x:10000:10000:SkunkyArt user:/:/sbin/nologin" > /etc/minimal-passwd && \
  9. echo "skunkyart:x:10000:" > /etc/minimal-group
  10. FROM scratch
  11. COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
  12. COPY --from=build /build/static /static
  13. COPY --from=build /build/skunkyart /skunkyart
  14. COPY --from=build /etc/minimal-passwd /etc/passwd
  15. COPY --from=build /etc/minimal-group /etc/group
  16. USER skunkyart
  17. ENTRYPOINT ["/skunkyart"]