-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (20 loc) · 764 Bytes
/
Dockerfile
File metadata and controls
26 lines (20 loc) · 764 Bytes
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
# Build a go app into a minimal docker image with timezone support and SSL cert chains.
FROM golang:latest@sha256:c83e68f3ebb6943a2904fa66348867d108119890a2c6a2e6f07b38d0eb6c25c5 as builder
ARG TARGETOS
ARG TARGETARCH
ARG BUILD_FLAGS=""
RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src /build
COPY . /build
WORKDIR /build
RUN apt update \
&& apt install -y tzdata \
&& go generate ./... \
&& GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 \
go build ${BUILD_FLAGS} -o /authproxy .
FROM scratch
COPY --from=builder /authproxy /authproxy
# Make sure we have an ssl cert chain and timezone data.
COPY --from=builder /etc/ssl /etc/ssl
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
ENV TZ=UTC
ENTRYPOINT [ "/authproxy" ]