Skip to content

Commit

Permalink
Switch from alpine to distroless, add -extldflags static
Browse files Browse the repository at this point in the history
  • Loading branch information
seslattery committed Nov 28, 2023
1 parent 08cd511 commit 9214290
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ builds:
- goos: freebsd
goarch: "386"
ldflags:
- -s -w -X github.com/DopplerHQ/cli/pkg/version.ProgramVersion=v{{.Version}}
- -extldflags "-static" -s -w -X github.com/DopplerHQ/cli/pkg/version.ProgramVersion=v{{.Version}}

archives:
-
Expand Down Expand Up @@ -105,7 +105,7 @@ changelog:
- Merge branch

dockers:
- dockerfile: docker/alpine
- dockerfile: docker/Dockerfile
goos: linux
goarch: amd64
ids:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: build release test

build:
go build -o doppler -ldflags="-X github.com/DopplerHQ/cli/pkg/version.ProgramVersion=dev-$(shell git rev-parse --abbrev-ref HEAD)-$(shell git rev-parse --short HEAD)" main.go
GGO_ENABLED=0 go build -o doppler -ldflags="-extldflags "-static" -X github.com/DopplerHQ/cli/pkg/version.ProgramVersion=dev-$(shell git rev-parse --abbrev-ref HEAD)-$(shell git rev-parse --short HEAD)" main.go

test:
go test ./pkg/... -v
Expand Down
11 changes: 11 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM debian:12-slim as build
RUN apt-get update \
&& apt-get install -y \
tini \
&& rm -rf /var/lib/apt/lists/*

FROM gcr.io/distroless/static-debian12:latest-amd64
COPY --from=build /usr/bin/tini-static /usr/bin/tini-static

COPY doppler /bin/doppler
ENTRYPOINT ["/usr/bin/tini-static", "--", "/bin/doppler"]

0 comments on commit 9214290

Please sign in to comment.