forked from minekube/gate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (26 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
33 lines (26 loc) · 1.08 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
FROM --platform=$BUILDPLATFORM golang:1.24.2 AS build
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.sum ./
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY cmd ./cmd
COPY pkg ./pkg
COPY gate.go ./
# Automatically provided by the buildkit
ARG TARGETOS TARGETARCH
# Build
ARG VERSION=unknown
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -ldflags="-s -w -X 'go.minekube.com/gate/pkg/version.Version=${VERSION}'" -a -o gate gate.go
# Move binary into final image (default Gate image - distroless)
FROM --platform=$BUILDPLATFORM gcr.io/distroless/static-debian12 AS gate
COPY --from=build /workspace/gate /
ENTRYPOINT ["/gate"]
# Move binary into final image (jre variant Gate image - temurin-25-jre-alpine)
FROM --platform=$BUILDPLATFORM eclipse-temurin:25-jre-alpine AS jre
COPY --from=build /workspace/gate /usr/local/bin/gate
ENV PATH=/opt/java/openjdk/bin:$PATH
ENTRYPOINT ["/usr/local/bin/gate"]