quality / commitlint (push) Skipped
quality / changes (push) Successful in 8s
quality / openapi (push) Skipped
quality / web (push) Skipped
quality / docker-check (push) Skipped
quality / go (push) Successful in 57s
quality / bird2 (push) Successful in 15s
CD / quality (push) Successful in 1m27s
CD / publish (push) Failing after 4m13s
- Changed base image references in `docker-bake.hcl`, Dockerfiles, and `mirror-base-images.sh` from public ECR to Docker Hub to avoid 429 errors and improve reliability. - Updated README documentation to reflect the new source for base images, clarifying the mirroring process and behavior when tags already exist.
80 lines
3.1 KiB
Docker
80 lines
3.1 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
# Универсальная сборка бинарей cmd/* (ARG BIN) или всех сразу (target build-all).
|
|
# Воркеры (runtime): distroless static. api/all (runtime-birdc): debian-slim + 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 / deploy / node — 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 — birdc (readline + ncurses). Только клиент birdc, без демона bird.
|
|
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/birdc /usr/local/sbin/birdc
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/evobgp"]
|