Files
EvoBGP/deploy/docker/README.md
T
Denozordec 27e01d010f
CI / changes (push) Successful in 6s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 22s
CI / docker-web (push) Failing after 14s
CI / docker-bird (push) Failing after 14s
CI / bird2 (push) Successful in 14s
CI / docker-go (push) Failing after 14s
refactor: update Docker build variable syntax in CI configuration and documentation
Changed the variable assignment syntax in the CI workflow from `--set` to `--var` for Docker build commands. Updated the README to reflect this change and clarify the usage of variables in the docker-bake.hcl file.
2026-05-19 10:50:05 +07:00

47 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Docker-образы EvoBGP
## CI (Gitea Actions)
Сборка образов — **`docker buildx bake`** (`deploy/docker/docker-bake.hcl`), а не матрица из восьми отдельных `docker build`.
| Было | Стало |
|------|--------|
| 8× `go mod download` + 8× `go build` (разные BIN) | 1× download + 1× компиляция всех `cmd/*` |
| 2× сборка BIRD из исходников (api, all) | 1× stage `birdc`, копируется в runtime |
| 2× `npm ci` (web, web-all) | 1× `web-deps` + два nginx-образа |
| 8 runner'ов с checkout/login | 1 job `docker-go`, 1 job `docker-web` |
Кэш registry (переменные bake):
- `git.shts.su/<owner>/evobgp-buildcache:go-buildcache`
- `git.shts.su/<owner>/evobgp-buildcache:web-buildcache`
Локально BuildKit также кэширует `/go/pkg/mod` и `~/.cache/go-build` через `RUN --mount=type=cache`.
## Локальная сборка
Из корня репозитория:
```bash
cd deploy/docker
docker buildx bake -f docker-bake.hcl go-images \
--var "REGISTRY=git.shts.su/<owner>" \
--var "IMAGE_TAG=latest" \
--var "SHORT_SHA=$(git rev-parse --short HEAD)"
docker buildx bake -f docker-bake.hcl web-images \
--var "REGISTRY=git.shts.su/<owner>"
```
Переменные из `variable` в `docker-bake.hcl` передаются флагом **`--var NAME=value`** (не `--set`: он только для полей target вроде `tags`, `args`).
Один образ (legacy):
```bash
docker build -f deploy/docker/gobinary/Dockerfile \
--target build-all \
--build-arg BIN=evobgp-api \
-t evobgp-api:local .
```
Runtime-образы в bake ожидают stage `build-all` (через bake contexts), не отдельный `--build-arg BIN` на старый target `build`.