mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-22 13:50:49 +01:00
Simplify Dockerfile setup
The Dockerfile has been streamlined to remove unnecessary steps and over-complications. Previously the setup involved building in a separate stage and copying files over, which has now been simplified to just copying the necessary executable to the scratch container and specifying the entry point.
This commit is contained in:
parent
f871dfb82b
commit
0ec81e16cc
1 changed files with 2 additions and 22 deletions
24
Dockerfile
24
Dockerfile
|
@ -1,23 +1,3 @@
|
||||||
## Build first
|
|
||||||
FROM golang:latest AS builder
|
|
||||||
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 \
|
|
||||||
src.neessen.cloud/wneessen/apg-go/cmd/apg
|
|
||||||
|
|
||||||
## Create scratch image
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
LABEL maintainer="wn@neessen.dev"
|
ENTRYPOINT ["/apg"]
|
||||||
COPY ["docker-files/passwd", "/etc/passwd"]
|
COPY apg /
|
||||||
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
|
|
||||||
ENTRYPOINT ["/apg-go/apg-go"]
|
|
Loading…
Reference in a new issue