quality / commitlint (push) Skipped
quality / changes (push) Successful in 7s
quality / openapi (push) Skipped
quality / web (push) Skipped
quality / docker-check (push) Skipped
quality / go (push) Failing after 44s
quality / bird2 (push) Skipped
CD / quality (push) Failing after 55s
CD / publish (push) Skipped
- Changed the inheritance for `evobgp-deploy` and `evobgp-node` targets to use `_go-runtime-birdc`, reflecting the inclusion of the `bird` and `birdc` components. - Updated README and Dockerfile comments to clarify the runtime environments for various evobgp components, specifying the use of `bird` and `birdc` for parse-check functionality. - Adjusted quickstart documentation to accurately describe the `evobgp-api` image, highlighting the inclusion of `bird` and `birdc` for enhanced functionality.
82 lines
3.3 KiB
Docker
82 lines
3.3 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
# Универсальная сборка бинарей cmd/* (ARG BIN) или всех сразу (target build-all).
|
|
# Воркеры (runtime): distroless static. api/all/deploy/node (runtime-birdc): debian-slim + bird + birdc.
|
|
# CI: docker buildx bake -f deploy/docker/docker-bake.hcl
|
|
ARG BASE_GOLANG=docker.io/library/golang:1.24-alpine
|
|
ARG BASE_DEBIAN=docker.io/library/debian:bookworm-slim
|
|
ARG BASE_DISTROLESS=gcr.io/distroless/static-debian12:nonroot
|
|
|
|
FROM ${BASE_GOLANG} AS deps
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
|
go mod download
|
|
|
|
FROM deps AS build-all
|
|
ARG VERSION=dev
|
|
ARG GIT_SHA=unknown
|
|
ARG BUILD_TIME=
|
|
RUN --mount=type=bind,target=. \
|
|
--mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
|
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \
|
|
set -eux; \
|
|
mkdir -p /out; \
|
|
for d in cmd/*/; do \
|
|
name="$(basename "$d")"; \
|
|
CGO_ENABLED=0 go build -trimpath \
|
|
-ldflags="-s -w \
|
|
-X evobgp/internal/version.Version=${VERSION} \
|
|
-X evobgp/internal/version.GitSHA=${GIT_SHA} \
|
|
-X evobgp/internal/version.BuildTime=${BUILD_TIME}" \
|
|
-o "/out/${name}" "./cmd/${name}"; \
|
|
done
|
|
|
|
# Один бинарь (локальная сборка); в CI — build-all + runtime.
|
|
FROM deps AS build
|
|
ARG BIN=evobgp-api
|
|
ARG VERSION=dev
|
|
ARG GIT_SHA=unknown
|
|
ARG BUILD_TIME=
|
|
RUN --mount=type=bind,target=. \
|
|
--mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
|
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \
|
|
CGO_ENABLED=0 go build -trimpath \
|
|
-ldflags="-s -w \
|
|
-X evobgp/internal/version.Version=${VERSION} \
|
|
-X evobgp/internal/version.GitSHA=${GIT_SHA} \
|
|
-X evobgp/internal/version.BuildTime=${BUILD_TIME}" \
|
|
-o /out/evobgp "./cmd/${BIN}"
|
|
|
|
FROM ${BASE_DEBIAN} AS birdc
|
|
ARG BIRD_VERSION=2.14
|
|
COPY deploy/docker/bird/bird-from-source.sh /tmp/bird-from-source.sh
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
&& chmod +x /tmp/bird-from-source.sh \
|
|
&& BIRD_VERSION="${BIRD_VERSION}" /tmp/bird-from-source.sh \
|
|
&& rm -f /tmp/bird-from-source.sh
|
|
|
|
# scheduler / ingest / render — static Go, без shell.
|
|
FROM ${BASE_DISTROLESS} AS runtime
|
|
ARG BIN=evobgp-api
|
|
COPY --from=build-all /out/${BIN} /usr/local/bin/evobgp
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/evobgp"]
|
|
|
|
# api / all / deploy / node — bird -p (parse-check) + birdc configure.
|
|
# Демон BIRD в этом контейнере не запускается; процесс bird — в образе evobgp-bird2.
|
|
FROM ${BASE_DEBIAN} AS runtime-birdc
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates libreadline8 libncurses6 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
ARG BIN=evobgp-api
|
|
COPY --from=build-all /out/${BIN} /usr/local/bin/evobgp
|
|
COPY --from=birdc /usr/local/sbin/bird /usr/local/sbin/bird
|
|
COPY --from=birdc /usr/local/sbin/birdc /usr/local/sbin/birdc
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/evobgp"]
|