1- FROM golang:1.24 -alpine AS build
1+ FROM golang:1.26 -alpine AS build
22
33WORKDIR /src
44
5- COPY go.mod go.sum ./
5+ # Copy module manifests for dependency caching.
6+ # The server module is the main build context; instruments comes from a named
7+ # build context (--build-context instruments=<path>).
8+ COPY go.mod go.sum ./server/
9+ COPY --from=instruments go.mod go.sum ./instruments/
10+
11+ # Create a workspace file matching the Docker filesystem layout.
12+ # The repo go.work uses ../flink-reactor-instruments/server — this adapts
13+ # those paths for the flat /src/{server,instruments} layout inside the image.
14+ RUN printf 'go 1.26.0\n\n use ./server\n use ./instruments\n ' > go.work
15+
16+ # Download external dependencies (layer is cached unless go.mod/go.sum change).
17+ WORKDIR /src/server
18+ RUN go mod download
19+ WORKDIR /src/instruments
620RUN go mod download
721
8- COPY . .
22+ # Copy full source for both modules.
23+ WORKDIR /src
24+ COPY . ./server/
25+ COPY --from=instruments . ./instruments/
26+
27+ # Build the server binary.
28+ WORKDIR /src/server
929RUN CGO_ENABLED=0 go build -o /usr/local/bin/reactor-server ./cmd/reactor-server/
1030
1131FROM alpine:3.21
@@ -14,8 +34,7 @@ RUN adduser -D -u 1000 reactor
1434
1535COPY --from=build /usr/local/bin/reactor-server /usr/local/bin/reactor-server
1636
17- # Copy dashboard static export if available (built externally).
18- # The STATIC_DIR env var tells reactor-server where to find SPA files.
37+ # Copy dashboard static export (built by the just docker recipe).
1938COPY --chown=reactor:reactor dashboard/ /app/dashboard/
2039ENV STATIC_DIR=/app/dashboard
2140
0 commit comments