feat: update CI configuration and Dockerfiles for improved build efficiency
CI / changes (push) Successful in 7s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 1m29s
CI / docker-web (push) Failing after 15s
CI / docker-bird (push) Failing after 14s
CI / bird2 (push) Successful in 14s
CI / docker-go (push) Failing after 14s
CI / changes (push) Successful in 7s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 1m29s
CI / docker-web (push) Failing after 15s
CI / docker-bird (push) Failing after 14s
CI / bird2 (push) Successful in 14s
CI / docker-go (push) Failing after 14s
Enhanced the CI workflow by adding support for docker-bake.hcl to streamline the building and pushing of Go images. Updated Go version to 1.24 and introduced caching for Go module dependencies. Refactored Dockerfiles for evobgp-agent, evobgp-web, and gobinary to utilize build stages more effectively, improving caching and build performance. Adjusted installation commands and entry points for better clarity and maintainability.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# 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
|
||||
docker buildx bake -f docker-bake.hcl web-images
|
||||
```
|
||||
|
||||
Один образ (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`.
|
||||
Reference in New Issue
Block a user