-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.2 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.2 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
# syntax=docker/dockerfile:1
# Stage 1: Build frontend (Node.js)
FROM --platform=$BUILDPLATFORM node:22-slim AS frontend-builder
WORKDIR /src
RUN apt-get update && apt-get install -y --no-install-recommends \
make && rm -rf /var/lib/apt/lists/*
COPY frontend ./frontend
COPY utils ./utils
COPY Makefile ./
RUN --mount=type=cache,target=/root/.npm \
make build-frontend
# Stage 2: Build Go artifacts
FROM --platform=$BUILDPLATFORM golang:1 AS go-builder
WORKDIR /src
RUN apt-get update && apt-get install -y --no-install-recommends \
make && rm -rf /var/lib/apt/lists/*
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY . .
RUN rm -rf bin/
COPY --from=frontend-builder /src/cmd/relay-server/dist/app ./cmd/relay-server/dist/app
ARG TARGETOS
ARG TARGETARCH
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
make build-tunnel && \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build-server
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=go-builder /src/bin/relay-server /usr/bin/relay-server
ENV PORTAL_URL=https://localhost:4017
ENV IDENTITY_PATH=/portal-certs
ENV TZ=UTC
EXPOSE 4017
ENTRYPOINT ["/usr/bin/relay-server"]