Skip to content

Commit

Permalink
fix: simplify dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kuritka committed Sep 12, 2024
1 parent 75248f7 commit 8b17413
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
go-version: [1.22.x]
go-version: [1.23.x]

steps:
- name: Checkout repository
Expand Down
26 changes: 1 addition & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,11 @@
# Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
ARG ARCH

# Build the manager binary
FROM golang:1.23 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download

# Copy the go source
COPY main.go main.go
COPY pkg/ pkg/

ARG ldflags

# Build
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
go build -trimpath -ldflags "${ldflags}" -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot-${ARCH}
WORKDIR /
COPY --from=builder /workspace/manager .
COPY manager managr
USER 65532

ENTRYPOINT ["/manager"]

0 comments on commit 8b17413

Please sign in to comment.