-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
39 lines (26 loc) · 946 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23-bullseye@sha256:bc1b90c2a8eb0ffb62325e02a85d51031ad3afae15b3df4b6a48b7929b00badb AS builder
ARG SOURCE_DATE_EPOCH
ARG TARGETOS
ARG TARGETARCH
ENV GOPATH=/usr/home/build
ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}
RUN mkdir -p /newroot/etc/ssl/certs \
&& cp -ra --parents /etc/ssl/certs /newroot/
WORKDIR /usr/home/build/src
COPY ./src/go.mod ./src/go.sum ./
RUN go mod download
COPY ./src ./
RUN GOPROXY=off \
CGO_ENABLED=0 \
go build \
-o /newroot/usr/local/bin/ecr-proxy \
./cmd/ecr-proxy
# Hack to reset timestamps on directories in a multi-platform build
RUN find /newroot -newermt "@${SOURCE_DATE_EPOCH}" -writable \
| xargs touch --date="@${SOURCE_DATE_EPOCH}" --no-dereference
FROM scratch
LABEL org.opencontainers.image.source=https://github.com/tkhq/ecr-proxy
COPY --from=builder /newroot /
USER 65532:65532
ENTRYPOINT ["/usr/local/bin/ecr-proxy"]