-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.mock-convox
More file actions
39 lines (27 loc) · 950 Bytes
/
Dockerfile.mock-convox
File metadata and controls
39 lines (27 loc) · 950 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
# syntax=docker/dockerfile:1.5
FROM golang:1.26.2-alpine AS builder
RUN apk add --no-cache git make
WORKDIR /app
# Cache go dependencies with BuildKit caches
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 for mock-convox
COPY cmd/mock-convox ./cmd/mock-convox
COPY internal/logging ./internal/logging
# Build mock binary with caches
RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \
go build -o /out/mock-convox ./cmd/mock-convox \
&& /out/mock-convox help
# Final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy the binary from builder
COPY --from=builder /out/mock-convox .
EXPOSE 5443
CMD ["./mock-convox"]