Skip to content

Commit

Permalink
[goreleaser] refactor: update Dockerfile to copy pre-built binary and…
Browse files Browse the repository at this point in the history
… simplify goreleaser config

Co-Authored-By: [email protected] <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and trajan0x committed Dec 14, 2024
1 parent 3959cfa commit ba291bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
6 changes: 0 additions & 6 deletions contrib/golang-ci-lint/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ builds:
- -s -w -extldflags '-static'
tags:
- netgo
- osusergo
env:
- CGO_ENABLED=0
main: main.go
Expand All @@ -38,11 +37,6 @@ dockers:
- '--label=org.opencontainers.image.version={{.Version}}'
- '--label=org.opencontainers.image.source={{.GitURL}}'
dockerfile: ../../docker/golang-ci-lint.Dockerfile
extra_files:
- go.mod
- go.sum
- main.go
- permissions/
ids:
- golang-ci-lint

Expand Down
22 changes: 6 additions & 16 deletions docker/golang-ci-lint.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
# syntax=docker/dockerfile:1.4

FROM golang:1.21-alpine AS builder

WORKDIR /build
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -o /build/bin/golang-ci-lint \
-ldflags="-s -w -extldflags '-static'" \
-tags netgo,osusergo \
-trimpath

FROM alpine:3.18
FROM gcr.io/distroless/static:latest

LABEL org.opencontainers.image.source="https://github.com/synapsecns/sanguine"
LABEL org.opencontainers.image.description="Golang-CI-Lint version manager for Sanguine"
Expand All @@ -19,7 +7,9 @@ LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.vendor="Synapse Labs"
LABEL org.opencontainers.image.documentation="https://github.com/synapsecns/sanguine/tree/master/contrib/golang-ci-lint"

COPY --from=builder /build/bin/golang-ci-lint /usr/local/bin/
RUN chmod +x /usr/local/bin/golang-ci-lint
USER nonroot:nonroot

WORKDIR /app
COPY --chown=nonroot:nonroot golang-ci-lint /app/golang-ci-lint

ENTRYPOINT ["/usr/local/bin/golang-ci-lint"]
ENTRYPOINT ["/app/golang-ci-lint"]

0 comments on commit ba291bc

Please sign in to comment.