docs: enhance README and CI workflow documentation for Docker image building and publishing process, including registry setup and job conditions for main/master branches
CI / changes (push) Successful in 5s
CI / go (push) Successful in 23s
CI / openapi (push) Has been skipped
CI / bird2 (push) Successful in 14s
CI / docker-images (deploy/docker/bird2/Dockerfile, evobgp-bird2) (push) Successful in 50s
CI / docker-images (deploy/docker/evobgp-agent/Dockerfile, evobgp-agent) (push) Successful in 1m6s
CI / docker-images (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, evobgp-all) (push) Has been cancelled
CI / docker-images (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, evobgp-api) (push) Has been cancelled
CI / docker-images (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, evobgp-deploy) (push) Has been cancelled
CI / docker-images (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, evobgp-ingest) (push) Has been cancelled
CI / docker-images (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, evobgp-node) (push) Has been cancelled
CI / docker-images (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, evobgp-render) (push) Has been cancelled
CI / docker-images (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, evobgp-scheduler) (push) Has been cancelled
CI / docker-images (deploy/docker/evobgp-web/Dockerfile, evobgp-web) (push) Has been cancelled

This commit is contained in:
Denozordec
2026-04-05 17:52:17 +07:00
parent 032fa9945c
commit 9eb3e33e67
3 changed files with 170 additions and 2 deletions
+123
View File
@@ -111,3 +111,126 @@ jobs:
echo "==> $conf"
bird -c "$WS/$conf" -p
done
# Сборка образов и push в Container Registry Gitea (только push в main/master; см. .gitea/README.md).
docker-images:
needs: [go]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: evobgp-api
dockerfile: deploy/docker/gobinary/Dockerfile
bin: evobgp-api
birdc: "1"
- image: evobgp-all
dockerfile: deploy/docker/gobinary/Dockerfile
bin: evobgp-all
birdc: "1"
- image: evobgp-scheduler
dockerfile: deploy/docker/gobinary/Dockerfile
bin: evobgp-scheduler
birdc: "0"
- image: evobgp-ingest
dockerfile: deploy/docker/gobinary/Dockerfile
bin: evobgp-ingest
birdc: "0"
- image: evobgp-render
dockerfile: deploy/docker/gobinary/Dockerfile
bin: evobgp-render
birdc: "0"
- image: evobgp-deploy
dockerfile: deploy/docker/gobinary/Dockerfile
bin: evobgp-deploy
birdc: "0"
- image: evobgp-node
dockerfile: deploy/docker/gobinary/Dockerfile
bin: evobgp-node
birdc: "0"
- image: evobgp-web
dockerfile: deploy/docker/evobgp-web/Dockerfile
- image: evobgp-agent
dockerfile: deploy/docker/evobgp-agent/Dockerfile
- image: evobgp-bird2
dockerfile: deploy/docker/bird2/Dockerfile
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Prepare registry (REGISTRY in env + outputs)
id: meta
env:
HOST: ${{ secrets.GITEA_REGISTRY_HOST }}
run: |
set -euo pipefail
owner_lc="$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')"
echo "owner_lc=$owner_lc" >> "$GITHUB_OUTPUT"
short_sha="$(echo '${{ github.sha }}' | cut -c1-7)"
echo "short_sha=$short_sha" >> "$GITHUB_OUTPUT"
if [ -z "${HOST:-}" ]; then
echo "GITEA_REGISTRY_HOST not set — build without push."
echo "docker_push=false" >> "$GITHUB_OUTPUT"
echo "REGISTRY=" >> "$GITHUB_ENV"
else
h="$HOST"
h="${h#https://}"
h="${h#http://}"
h="${h%/}"
echo "docker_push=true" >> "$GITHUB_OUTPUT"
echo "REGISTRY=$h" >> "$GITHUB_ENV"
fi
- name: Log in to Gitea Registry
if: steps.meta.outputs.docker_push == 'true' && secrets.ACTIONS_PAT != ''
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.ACTIONS_PAT }}
- name: Build and push ${{ matrix.image }}
env:
OWNER_LC: ${{ steps.meta.outputs.owner_lc }}
SHORT_SHA: ${{ steps.meta.outputs.short_sha }}
DO_PUSH: ${{ steps.meta.outputs.docker_push }}
PAT_OK: ${{ secrets.ACTIONS_PAT != '' }}
DF: ${{ matrix.dockerfile }}
IMAGE: ${{ matrix.image }}
BIN: ${{ matrix.bin }}
BIRDC: ${{ matrix.birdc }}
run: |
set -euxo pipefail
WS="${{ github.workspace }}"
cd "$WS"
TAG_LOCAL="evobgp:${IMAGE}-${SHORT_SHA}"
BUILD_ARGS=()
if [ -n "${BIN:-}" ]; then
BUILD_ARGS+=(--build-arg "BIN=${BIN}")
BUILD_ARGS+=(--build-arg "INSTALL_BIRDC=${BIRDC:-0}")
fi
if [ "$DO_PUSH" = "true" ] && [ -n "${REGISTRY:-}" ] && [ "$PAT_OK" = "true" ]; then
IMG="${REGISTRY}/${OWNER_LC}/${IMAGE}"
docker buildx build \
--platform linux/amd64 \
--file "$DF" \
"${BUILD_ARGS[@]}" \
--tag "${IMG}:latest" \
--tag "${IMG}:${SHORT_SHA}" \
--tag "${IMG}:sha-${{ github.sha }}" \
--push \
"$WS"
else
docker buildx build \
--platform linux/amd64 \
--file "$DF" \
"${BUILD_ARGS[@]}" \
--tag "$TAG_LOCAL" \
--load \
"$WS"
fi