-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (46 loc) · 1.86 KB
/
Dockerfile
File metadata and controls
66 lines (46 loc) · 1.86 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# syntax=docker/dockerfile:1.4
ARG envoy_version="v1.25.1"
FROM --platform=$BUILDPLATFORM golang:1.20-bullseye as build
WORKDIR /workspace
COPY go.mod go.sum .
RUN go mod download
COPY --from= . .
RUN go test ./...
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 \
go build -ldflags '-w -extldflags "-static"' \
-o /usr/local/bin/envoystatic ./cmd/envoystatic
FROM --platform=$TARGETPLATFORM gcr.io/distroless/static:nonroot as tooling
COPY --from=build /usr/local/bin /usr/local/bin
# The source tree is not meant to be preserved
VOLUME /workspace
# Entrypoint is unuseful for the recommended workflow (as FROM at build time)
# but helpful to test pipelines using local docker
ENTRYPOINT [ "/usr/local/bin/envoystatic" ]
FROM --platform=$TARGETPLATFORM envoyproxy/envoy:${envoy_version} as envoy
# This layer is used as the -debug image, until we have a skaffold verify workflow we need curl
RUN set -ex; export DEBIAN_FRONTEND=noninteractive; runDeps='curl'; \
apt-get update && apt-get install -y $runDeps --no-install-recommends; \
rm -rf /var/lib/apt/lists; \
rm -rf /var/log/dpkg.log /var/log/alternatives.log /var/log/apt /root/.gnupg
COPY bootstrap/* /etc/envoy/bootstrap/
RUN set -e; \
mkdir /etc/envoy/rds; \
ln -s /etc/envoy/bootstrap/route.yaml /etc/envoy/rds/route.yaml
USER envoy:nogroup
EXPOSE 8080/tcp
CMD [ "envoy", \
"-c", "/etc/envoy/bootstrap/envoy.yaml", \
"--service-cluster", "envoystatic", \
"--service-node", "envoystatic", \
"-l", "info" ]
FROM --platform=$TARGETPLATFORM envoyproxy/envoy-distroless:${envoy_version} as envoy-distroless
COPY --from=envoy /etc/passwd /etc/group /etc/
COPY --from=envoy /etc/envoy /etc/envoy
USER envoy:nogroup
EXPOSE 8080/tcp
CMD [ \
"-c", "/etc/envoy/bootstrap/envoy.yaml", \
"--service-cluster", "envoystatic", \
"--service-node", "envoystatic", \
"-l", "info" ]