2022-05-11 14:51:58 +02:00
|
|
|
## Build first
|
|
|
|
FROM golang:latest as builder
|
|
|
|
RUN mkdir /builddir
|
|
|
|
ADD . /builddir/
|
|
|
|
WORKDIR /builddir
|
2022-05-12 10:38:56 +02:00
|
|
|
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-w -s -extldflags "-static"' -o apg-go \
|
2022-05-11 14:51:58 +02:00
|
|
|
github.com/wneessen/apg-go/cmd/apg
|
|
|
|
|
|
|
|
## Create scratch image
|
|
|
|
FROM scratch
|
|
|
|
LABEL maintainer="wn@neessen.net"
|
|
|
|
COPY ["docker-files/passwd", "/etc/passwd"]
|
|
|
|
COPY ["docker-files/group", "/etc/group"]
|
2022-05-11 16:24:24 +02:00
|
|
|
COPY --from=builder ["/etc/ssl/certs/ca-certificates.crt", "/etc/ssl/cert.pem"]
|
2022-05-11 14:51:58 +02:00
|
|
|
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
|
|
|
|
ENTRYPOINT ["/apg-go/apg-go"]
|