2024-03-14 09:37:52 +01:00
|
|
|
# SPDX-FileCopyrightText: 2021-2024 Winni Neessen <wn@neessen.dev>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2024-07-02 21:30:21 +02:00
|
|
|
FROM golang:latest@sha256:c8736b8dbf2b12c98bb0eeed91eef58ecef52b8c2bd49b8044531e8d8d8d58e8 AS builder
|
2024-03-14 09:37:52 +01:00
|
|
|
RUN mkdir /builddir
|
|
|
|
ADD . /builddir/
|
|
|
|
WORKDIR /builddir
|
|
|
|
RUN go mod tidy
|
|
|
|
RUN go mod download
|
|
|
|
RUN go mod verify
|
|
|
|
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-w -s -extldflags "-static"' -o apg-go \
|
|
|
|
github.com/wneessen/apg-go/cmd/apg
|
|
|
|
|
|
|
|
## Create scratch image
|
2024-03-13 22:36:46 +01:00
|
|
|
FROM scratch
|
2024-03-14 09:37:52 +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"]
|
2024-03-14 10:07:44 +01:00
|
|
|
COPY --from=builder --chown=apg-go --chmod=555 ["/builddir/apg-go", "/apg-go/apg-go"]
|
2024-03-14 09:37:52 +01:00
|
|
|
WORKDIR /apg-go
|
|
|
|
USER apg-go
|
|
|
|
ENTRYPOINT ["/apg-go/apg-go"]
|