mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-01 20:41:28 +02:00
* Bump go version to 1.26 and go-quic to v0.62.0 * Replace deprecated ecdsa public key assembly and add tests for jwt * Update goversioninfo * Pin go toolchain to 1.26.7
30 lines
1.2 KiB
Docker
30 lines
1.2 KiB
Docker
FROM golang:1.26.7-bookworm AS builder
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y gcc libc6-dev git && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
|
|
|
COPY . .
|
|
|
|
# Build with version info from git (matching goreleaser ldflags).
|
|
# BuildKit cache mounts persist the module + build caches across image builds,
|
|
# so a source change recompiles incrementally instead of from scratch.
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=1 GOOS=linux go build \
|
|
-ldflags="-s -w \
|
|
-X github.com/netbirdio/netbird/version.version=$(git describe --tags --always --dirty 2>/dev/null || echo 'dev') \
|
|
-X main.commit=$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown') \
|
|
-X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
|
|
-X main.builtBy=docker" \
|
|
-o netbird-server ./combined
|
|
|
|
FROM ubuntu:24.04
|
|
RUN apt update && apt install -y ca-certificates && rm -fr /var/cache/apt
|
|
ENTRYPOINT [ "/go/bin/netbird-server" ]
|
|
CMD ["--config", "/etc/netbird/config.yaml"]
|
|
COPY --from=builder /app/netbird-server /go/bin/netbird-server
|