-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile.e2e-controller
More file actions
31 lines (26 loc) · 1.31 KB
/
Copy pathDockerfile.e2e-controller
File metadata and controls
31 lines (26 loc) · 1.31 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
# E2E test runner for Agent-to-Controller tests.
# Generates proto bindings, resolves dependencies, and runs Go tests.
FROM golang:1.27.0-bookworm
# Install protoc for code generation. This layer only depends on apt/Go tool
# versions, not application source, so it stays cached across source-only
# rebuilds.
RUN apt-get update && apt-get install -y --no-install-recommends \
protobuf-compiler netcat-openbsd \
&& rm -rf /var/lib/apt/lists/* \
&& go install google.golang.org/protobuf/cmd/protoc-gen-go@latest \
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
WORKDIR /app
# Copy module files first and resolve dependencies before copying the rest
# of the source tree, so `go mod download` is only re-run when go.mod/go.sum
# change (not on every source edit). go.sum is trusted as-is; it is expected
# to already be complete and committed (no `go mod tidy` in the container).
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
# Copy remaining source and generate protobuf bindings.
COPY . .
RUN cd proto/controller_agent && \
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
controller_agent.proto
CMD ["go", "test", "-v", "-count=1", "-timeout", "120s", "./e2e/controller/..."]