Skip to content

Commit

Permalink
Update to Go 1.23, address Dockerfile warnings and reorder operations…
Browse files Browse the repository at this point in the history
… for build cache
  • Loading branch information
simonmarty authored Nov 13, 2024
1 parent bfca7a4 commit f0baeec
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
FROM --platform=$TARGETPLATFORM golang:1.19-alpine as go
ARG TARGETPLATFORM
FROM golang:1.23-alpine AS go
ARG BUILDPLATFORM
ARG TARGETPLATFORM
WORKDIR /workdir

RUN echo "Running on ${BUILDPLATFORM}, building for ${TARGETPLATFORM}."
RUN apk add git build-base
RUN go env -w GOPROXY=direct

WORKDIR /workdir
COPY go.mod .
COPY go.sum .

RUN apk add git build-base
RUN go env -w GOPROXY=direct
RUN go mod download -x

COPY . .

RUN go build -v -o _output/secrets-store-csi-driver-provider-aws

FROM --platform=$TARGETPLATFORM public.ecr.aws/amazonlinux/amazonlinux:2 as al2
ARG TARGETPLATFORM
FROM public.ecr.aws/amazonlinux/amazonlinux:2 AS al2

FROM scratch

COPY --from=go /workdir/_output/secrets-store-csi-driver-provider-aws /bin/secrets-store-csi-driver-provider-aws

# Copy current certificates from AL2 (/etc/pki/ symlinked in /etc/ssl/certs/)
COPY --from=al2 /etc/pki/ /etc/pki/
COPY --from=al2 /etc/ssl/certs/ /etc/ssl/certs

COPY --from=go /workdir/_output/secrets-store-csi-driver-provider-aws /bin/secrets-store-csi-driver-provider-aws

ENTRYPOINT ["/bin/secrets-store-csi-driver-provider-aws"]

0 comments on commit f0baeec

Please sign in to comment.