Skip to content

Commit fa8b071

Browse files
committed
Create containers
1 parent 10387d4 commit fa8b071

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ dashboard/.env.staging
395395

396396
### Go ###
397397
bin/
398+
server/dashboard/
398399
*.exe
399400
*.exe~
400401
*.dll

server/Dockerfile

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
FROM golang:1.24-alpine AS build
1+
FROM golang:1.26-alpine AS build
22

33
WORKDIR /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\nuse ./server\nuse ./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
620
RUN 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
929
RUN CGO_ENABLED=0 go build -o /usr/local/bin/reactor-server ./cmd/reactor-server/
1030

1131
FROM alpine:3.21
@@ -14,8 +34,7 @@ RUN adduser -D -u 1000 reactor
1434

1535
COPY --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).
1938
COPY --chown=reactor:reactor dashboard/ /app/dashboard/
2039
ENV STATIC_DIR=/app/dashboard
2140

server/justfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,23 @@ generate:
2020
dev:
2121
go run ./cmd/reactor-server/
2222

23-
# Build Docker image
23+
# Build Docker image (builds dashboard, copies static assets, then builds image)
2424
docker:
25-
docker build -t reactor-server .
25+
cd .. && pnpm build
26+
mkdir -p dashboard
27+
rsync -a --delete ../dashboard/dist/ dashboard/
28+
docker build \
29+
--build-context instruments=../../flink-reactor-instruments/server \
30+
-t reactor-server .
31+
32+
# Build Docker image inside minikube's Docker daemon
33+
docker-minikube:
34+
cd .. && pnpm build
35+
mkdir -p dashboard
36+
rsync -a --delete ../dashboard/dist/ dashboard/
37+
eval $(minikube docker-env) && docker build \
38+
--build-context instruments=../../flink-reactor-instruments/server \
39+
-t reactor-server .
2640

2741
# Run tests with coverage
2842
coverage:

0 commit comments

Comments
 (0)