mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 00:51:28 +02:00
e2e/harness documents itself as feature-agnostic, but three details assumed the caller lives in this repo, so the terraform provider's acceptance suite would otherwise carry a second harness for the same product. repoRoot took the first module root above the working directory as the Docker build context, which from another module is the caller's own root, with no combined/Dockerfile.multistage in it. It now requires that ancestor to be this module, and otherwise asks the go tool for the source: for a dependent, the extracted directory of the version it pins, so the server matches the client library it was compiled against. That lookup uses -mod=readonly, since automatic vendor mode otherwise reports an empty Dir. Geolocation was disabled unconditionally. Agent-network ingest does not use it, but location-based posture checks need the database, and a rule management cannot evaluate fails rather than passing. StartClient pinned one network alias and set no hostname, so a second agent could not start and a peer's name was arbitrary. Management records that hostname, making it the peer's name in the API. The client entrypoint is copied with an explicit mode: git tracks it 100755, but the module cache extracts 0444, so a dependent's build produced a container exiting with "permission denied". Adds CombinedOption, WithGeolocation, WithServerEnv, ClientOption and WithClientName.
29 lines
1.4 KiB
Docker
29 lines
1.4 KiB
Docker
# Multistage build for the NetBird client used in e2e tests. The repo has no
|
|
# source-building client Dockerfile (client/Dockerfile packages a goreleaser
|
|
# artifact), so this mirrors its alpine runtime + entrypoint while compiling the
|
|
# CGO-free client inline. BuildKit cache mounts keep rebuilds incremental.
|
|
|
|
FROM golang:1.25-bookworm AS builder
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
|
COPY . .
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=0 GOOS=linux go build -o /out/netbird ./client
|
|
|
|
FROM alpine:3.24
|
|
RUN apk add --no-cache bash ca-certificates ip6tables iproute2 iptables
|
|
ENV NETBIRD_BIN="/usr/local/bin/netbird" \
|
|
NB_LOG_FILE="console,/var/log/netbird/client.log" \
|
|
NB_DAEMON_ADDR="unix:///var/run/netbird.sock" \
|
|
NB_ENABLE_CAPTURE="false" \
|
|
NB_ENTRYPOINT_SERVICE_TIMEOUT="30"
|
|
ENTRYPOINT [ "/usr/local/bin/netbird-entrypoint.sh" ]
|
|
# --chmod because the build context is not always a git checkout. A suite in
|
|
# another module builds from this module's extracted copy in the module cache,
|
|
# where every file is 0444 — the cache drops the executable bit git records — and
|
|
# a bare COPY then produces an entrypoint the runtime cannot exec.
|
|
COPY --chmod=0755 client/netbird-entrypoint.sh /usr/local/bin/netbird-entrypoint.sh
|
|
COPY --from=builder /out/netbird /usr/local/bin/netbird
|