-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
44 lines (35 loc) · 1.49 KB
/
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
40
41
42
43
44
# syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM golang:1.18 AS build
WORKDIR /src
# Copy over our mod and sum files, then run go mod download so we can cache the dependancies as three container layers
COPY --link go.mod go.sum ./
COPY --link server/go.mod server/go.sum ./server/
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go mod download && \
cd server && go mod download
# Now copy over the rest of the source code
COPY --link . .
# Now build the app for the target OS / architecture
ARG TARGETOS
ARG TARGETARCH
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
cd server && \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/emissary .
# Now we build the final image
FROM gcr.io/distroless/static
COPY --from=build /out/emissary /
LABEL org.opencontainers.image.authors="support@encore.dev" \
org.opencontainers.image.vendor="Encoretivity AB" \
org.opencontainers.image.title="Emissary Server" \
org.opencontainers.image.source="https://github.com/encoredev/emissary" \
org.opencontainers.image.description="Emissary is a server which is used by the Encore platform to securely tunnel into your cloud environment and is deployed alongside your Encore application"
ENV EMISSARY_HTTP_PORT=80
ENV EMISSARY_ALLOWED_PROXY_TARGETS="[]"
ENV EMISSARY_AUTH_KEYS="[]"
EXPOSE 80/tcp
USER nonroot:nonroot
ENTRYPOINT ["/emissary"]