CI / changes (push) Successful in 10s
CI / commitlint (push) Has been skipped
CI / openapi (push) Has been skipped
CI / web (push) Successful in 57s
CI / go (push) Successful in 1m11s
CI / bird2 (push) Successful in 15s
CI / release (push) Successful in 4m16s
Added a community selection feature to the firewall rules management UI, allowing users to specify BGP communities for block/accept policies. Updated the backend to support reading firewall scripts from a specified directory, improving script management. Enhanced documentation to clarify the new community functionality and its implications for firewall rules. Additionally, introduced tests for the firewall script endpoints to ensure proper functionality.
72 lines
2.7 KiB
Docker
72 lines
2.7 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
# Универсальная сборка бинарей cmd/* (ARG BIN) или всех сразу (target build-all).
|
|
# INSTALL_BIRDC=1 — birdc из stage birdc (собирается один раз, переиспользуется api/all).
|
|
# CI: docker buildx bake -f deploy/docker/docker-bake.hcl
|
|
FROM public.ecr.aws/docker/library/golang:1.24-bookworm 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
|
|
COPY . .
|
|
ARG VERSION=dev
|
|
ARG GIT_SHA=unknown
|
|
ARG BUILD_TIME=
|
|
RUN --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
|
|
COPY . .
|
|
ARG BIN=evobgp-api
|
|
ARG VERSION=dev
|
|
ARG GIT_SHA=unknown
|
|
ARG BUILD_TIME=
|
|
RUN --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 public.ecr.aws/docker/library/debian:bookworm-slim AS birdc
|
|
ARG BIRD_VERSION=2.14
|
|
COPY deploy/docker/bird/bird-from-source.sh /tmp/bird-from-source.sh
|
|
RUN chmod +x /tmp/bird-from-source.sh \
|
|
&& BIRD_VERSION="${BIRD_VERSION}" /tmp/bird-from-source.sh \
|
|
&& rm -f /tmp/bird-from-source.sh
|
|
|
|
FROM public.ecr.aws/docker/library/debian:bookworm-slim AS runtime-base
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
FROM runtime-base AS runtime
|
|
ARG BIN=evobgp-api
|
|
COPY --from=build-all /out/${BIN} /usr/local/bin/evobgp
|
|
COPY scripts/firewall /opt/evobgp/scripts/firewall
|
|
ENV EVOBGP_FIREWALL_SCRIPTS=/opt/evobgp/scripts/firewall
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/evobgp"]
|
|
|
|
FROM runtime AS runtime-birdc
|
|
# birdc: динамическая линковка readline + ncurses (debian bookworm).
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends libreadline8 libncurses6 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=birdc /usr/local/sbin/bird /usr/local/sbin/birdc /usr/local/sbin/
|