mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 02:16:28 +02:00
deployment: use distroless builds (#101)
Replaces the current alpine based Dockerfile with distroless. Improvements include: - Minimal surface area, ideal for static builds like pomerium. - Includes `ca-certificates` - Includes`nsswitch` Closes #97 .
This commit is contained in:
parent
1a3add8fbc
commit
c18f7d89ae
2 changed files with 8 additions and 13 deletions
19
Dockerfile
19
Dockerfile
|
@ -1,20 +1,15 @@
|
|||
FROM golang:alpine as build
|
||||
RUN apk --update --no-cache add ca-certificates git make
|
||||
FROM golang:latest as build
|
||||
WORKDIR /go/src/github.com/pomerium/pomerium
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GO111MODULE=on
|
||||
|
||||
WORKDIR /go/src/github.com/pomerium/pomerium
|
||||
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
# cache depedency downloads
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
# build
|
||||
RUN make build
|
||||
|
||||
RUN make
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
FROM gcr.io/distroless/static
|
||||
WORKDIR /pomerium
|
||||
COPY --from=build /go/src/github.com/pomerium/pomerium/bin/* /bin/
|
||||
CMD ["/bin/pomerium"]
|
||||
|
|
2
Makefile
2
Makefile
|
@ -25,7 +25,7 @@ CTIMEVAR=-X $(PKG)/internal/version.GitCommit=$(GITCOMMIT) \
|
|||
-X $(PKG)/internal/version.BuildMeta=$(BUILDMETA) \
|
||||
-X $(PKG)/internal/version.ProjectName=$(NAME) \
|
||||
-X $(PKG)/internal/version.ProjectURL=$(PKG)
|
||||
GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)"
|
||||
GO_LDFLAGS=-ldflags "-s -w $(CTIMEVAR)"
|
||||
GOOSARCHES = linux/amd64 darwin/amd64 windows/amd64
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue