-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: use goreleaser, new release-workflow and distroless image
Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de>
- Loading branch information
1 parent
c18da7e
commit 404c629
Showing
8 changed files
with
94 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
*.dll | ||
*.so | ||
*.dylib | ||
bin | ||
dist | ||
|
||
# Test binary, build with `go test -c` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
project_name: access-manager | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
goarm: | ||
- "6" | ||
- "7" | ||
ignore: | ||
- goos: linux | ||
goarch: "386" | ||
ldflags: | ||
- -s -w -X main.Version={{.Version}} -X main.Commit={{.Commit}} -X main.Date={{.CommitDate}} -X main.BuiltBy=goreleaser | ||
mod_timestamp: "{{.CommitTimestamp}}" | ||
flags: | ||
- -trimpath | ||
|
||
sboms: | ||
- artifacts: archive | ||
args: ["$artifact", "--file", "$document", "--output", "json"] | ||
|
||
snapshot: | ||
name_template: "{{ .Version }}" | ||
|
||
release: | ||
disable: true | ||
|
||
changelog: | ||
skip: true | ||
|
||
source: | ||
enabled: true | ||
|
||
signs: | ||
- cmd: cosign | ||
certificate: '${artifact}.pem' | ||
args: | ||
- sign-blob | ||
- '--output-certificate=${certificate}' | ||
- '--output-signature=${signature}' | ||
- '${artifact}' | ||
artifacts: all | ||
output: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,8 @@ | ||
FROM golang:1.17.5-buster as builder | ||
FROM gcr.io/distroless/base | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
ARG version | ||
ENV VERSION=$version | ||
|
||
WORKDIR /go/src/app | ||
COPY . . | ||
RUN TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} make manager && \ | ||
mv bin/manager_${TARGETOS}_${TARGETARCH} bin/manager | ||
|
||
|
||
FROM alpine:3.15 | ||
|
||
ENV USER_UID=1001 \ | ||
USER_NAME=access-manager | ||
|
||
RUN echo "${USER_NAME}:x:${USER_UID}:0:${USER_NAME} user:${HOME}:/sbin/nologin" >> /etc/passwd && \ | ||
mkdir -p "${HOME}" && \ | ||
chown "${USER_UID}:0" "${HOME}" && \ | ||
chmod ug+rwx "${HOME}" | ||
|
||
COPY --from=builder /go/src/app/bin/manager /usr/local/bin/access-manager | ||
COPY dist/access-manager_${TARGETOS}_${TARGETARCH}/access-manager /usr/local/bin/access-manager | ||
|
||
ENTRYPOINT ["/usr/local/bin/access-manager"] | ||
USER ${USER_UID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.