-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 865 Bytes
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 865 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
27
28
29
30
31
32
33
34
35
36
37
38
39
# Build stage
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
ARG VERSION=dev
ARG TARGETARCH
# System dependencies
RUN apk add --no-cache \
ca-certificates \
git \
make \
openssh
# Making sure that dependency is not touched
ENV GOFLAGS="-mod=readonly"
WORKDIR /s2s-proxy
# Dependency manifests
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
# Source code
COPY . .
# Build
# need to make clean first in case binaries to be built are stale
RUN make clean && CGO_ENABLED=0 make bins VERSION=${VERSION}
# Runtime stage
FROM alpine:3.22 AS base
COPY --from=builder /s2s-proxy/bins/s2s-proxy /usr/local/bin/
COPY --from=builder /s2s-proxy/scripts/entrypoint.sh /opt/entrypoint.sh
COPY --from=builder /s2s-proxy/scripts/start.sh /opt/start.sh
ENTRYPOINT ["/opt/entrypoint.sh"]
CMD ["/opt/start.sh"]