2024-03-13 23:34:23 +01:00
|
|
|
## Build first
|
|
|
|
FROM golang:latest AS builder
|
|
|
|
RUN mkdir /builddir
|
|
|
|
ADD . /builddir/
|
|
|
|
WORKDIR /builddir
|
2024-03-13 23:45:58 +01:00
|
|
|
RUN go mod tidy
|
|
|
|
RUN go mod download
|
|
|
|
RUN go mod verify
|
2024-03-13 23:34:23 +01:00
|
|
|
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-w -s -extldflags "-static"' -o apg-go \
|
2024-03-13 23:45:58 +01:00
|
|
|
src.neessen.cloud/wneessen/apg-go/cmd/apg
|
2024-03-13 22:45:25 +01:00
|
|
|
|
2024-03-13 23:34:23 +01:00
|
|
|
## Create scratch image
|
2024-03-13 22:36:46 +01:00
|
|
|
FROM scratch
|
2024-03-13 23:34:23 +01:00
|
|
|
LABEL maintainer="wn@neessen.dev"
|
|
|
|
COPY ["docker-files/passwd", "/etc/passwd"]
|
|
|
|
COPY ["docker-files/group", "/etc/group"]
|
|
|
|
COPY --from=builder ["/etc/ssl/certs/ca-certificates.crt", "/etc/ssl/cert.pem"]
|
|
|
|
COPY --chown=apg-go ["LICENSE", "/apg-go/LICENSE"]
|
|
|
|
COPY --chown=apg-go ["README.md", "/apg-go/README.md"]
|
|
|
|
COPY --from=builder --chown=apg-go ["/builddir/apg-go", "/apg-go/apg-go"]
|
|
|
|
WORKDIR /apg-go
|
|
|
|
USER apg-go
|
2024-03-13 23:45:58 +01:00
|
|
|
ENTRYPOINT ["/apg-go/apg-go"]
|