-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.gateway-dev
More file actions
34 lines (23 loc) · 901 Bytes
/
Dockerfile.gateway-dev
File metadata and controls
34 lines (23 loc) · 901 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
FROM golang:1.26.2-alpine AS builder
RUN apk add --no-cache git ca-certificates make gcc musl-dev
WORKDIR /app
# Cache go mod download
COPY go.mod go.sum ./
COPY internal/shims ./internal/shims
RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \
go mod download
# Copy only the source needed to build the gateway
COPY internal ./internal
COPY cmd/gateway ./cmd/gateway
# Build the gateway binary directly in this stage
RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \
CGO_ENABLED=0 go build -o /out/rack-gateway-api ./cmd/gateway \
&& /out/rack-gateway-api help
FROM alpine:latest
RUN apk --no-cache add ca-certificates curl
WORKDIR /root/
COPY --from=builder /out/rack-gateway-api .
EXPOSE 8080
CMD ["./rack-gateway-api"]