docker: update web image build process and README
CI / changes (push) Successful in 8s
CI / openapi (push) Has been skipped
CI / go (push) Has been skipped
CI / docker-web (push) Failing after 16s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 22s
CI / docker-go (push) Failing after 51s

- Added a new target "web-build" to streamline the build process for web artifacts.
- Updated "evobgp-web" and "evobgp-web-all" targets to utilize the new "web-build" context.
- Modified Dockerfile to reflect changes in the build stages and context for web artifacts.
- Revised README to clarify the new build process and dependencies.
This commit is contained in:
Denozordec
2026-05-19 13:37:32 +07:00
parent 87309cfcec
commit 92f6de8695
3 changed files with 28 additions and 6 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
|------|--------| |------|--------|
| 8× `go mod download` + 8× `go build` (разные BIN) | 1× download + 1× компиляция всех `cmd/*` | | 8× `go mod download` + 8× `go build` (разные BIN) | 1× download + 1× компиляция всех `cmd/*` |
| 2× сборка BIRD из исходников (api, all) | 1× stage `birdc`, копируется в runtime | | 2× сборка BIRD из исходников (api, all) | 1× stage `birdc`, копируется в runtime |
| 2× `npm ci` (web, web-all) | 1× `web-deps` + два nginx-образа | | 2× `npm ci` (web, web-all) | 1× `web-deps` + 1× `web-build` + два nginx-образа (общий артефакт) |
| 8 runner'ов с checkout/login | 1 job `docker-go`, 1 job `docker-web` | | 8 runner'ов с checkout/login | 1 job `docker-go`, 1 job `docker-web` |
Кэш registry (переменные bake): Кэш registry (переменные bake):
+24 -3
View File
@@ -65,7 +65,7 @@ group "go-images" {
} }
group "web-images" { group "web-images" {
targets = ["evobgp-web", "evobgp-web-all"] targets = ["web-deps", "web-build", "evobgp-web", "evobgp-web-all"]
} }
# --- Go: go mod download → все cmd/* → birdc (один раз) → runtime-образы --- # --- Go: go mod download → все cmd/* → birdc (один раз) → runtime-образы ---
@@ -202,13 +202,26 @@ target "web-deps" {
cache-to = web-cache-to() cache-to = web-cache-to()
} }
target "evobgp-web" { target "web-build" {
context = "../.." context = "../.."
dockerfile = "deploy/docker/evobgp-web/Dockerfile" dockerfile = "deploy/docker/evobgp-web/Dockerfile"
target = "build"
platforms = ["linux/amd64"] platforms = ["linux/amd64"]
contexts = { contexts = {
deps = "target:web-deps" deps = "target:web-deps"
} }
cache-from = web-cache-from()
cache-to = web-cache-to()
}
target "evobgp-web" {
context = "../.."
dockerfile = "deploy/docker/evobgp-web/Dockerfile"
target = "web"
platforms = ["linux/amd64"]
contexts = {
web-artifacts = "target:web-build"
}
args = { EVOBGP_UPSTREAM = "evobgp-api" } args = { EVOBGP_UPSTREAM = "evobgp-api" }
cache-from = web-cache-from() cache-from = web-cache-from()
cache-to = web-cache-to() cache-to = web-cache-to()
@@ -216,8 +229,16 @@ target "evobgp-web" {
} }
target "evobgp-web-all" { target "evobgp-web-all" {
inherits = ["evobgp-web"] context = "../.."
dockerfile = "deploy/docker/evobgp-web/Dockerfile"
target = "web"
platforms = ["linux/amd64"]
contexts = {
web-artifacts = "target:web-build"
}
args = { EVOBGP_UPSTREAM = "evobgp-all" } args = { EVOBGP_UPSTREAM = "evobgp-all" }
cache-from = web-cache-from()
cache-to = web-cache-to()
tags = image-tags("evobgp-web-all") tags = image-tags("evobgp-web-all")
} }
+3 -2
View File
@@ -1,5 +1,6 @@
# syntax=docker/dockerfile:1.7 # syntax=docker/dockerfile:1.7
# Статическая панель EvoBGP (SvelteKit) + nginx. # Статическая панель EvoBGP (SvelteKit) + nginx.
# Финальный stage `web` ожидает bake-контекст web-artifacts (= target:web-build).
FROM public.ecr.aws/docker/library/node:22-alpine AS deps FROM public.ecr.aws/docker/library/node:22-alpine AS deps
WORKDIR /web WORKDIR /web
COPY web/package.json web/package-lock.json ./ COPY web/package.json web/package-lock.json ./
@@ -10,9 +11,9 @@ FROM deps AS build
COPY web/ ./ COPY web/ ./
RUN npm run build RUN npm run build
FROM public.ecr.aws/docker/library/nginx:1.27-alpine FROM public.ecr.aws/docker/library/nginx:1.27-alpine AS web
ARG EVOBGP_UPSTREAM=evobgp-api ARG EVOBGP_UPSTREAM=evobgp-api
COPY deploy/docker/evobgp-web/nginx.conf /tmp/nginx-default.conf COPY deploy/docker/evobgp-web/nginx.conf /tmp/nginx-default.conf
RUN sed -e "s/evobgp-api/${EVOBGP_UPSTREAM}/g" /tmp/nginx-default.conf > /etc/nginx/conf.d/default.conf \ RUN sed -e "s/evobgp-api/${EVOBGP_UPSTREAM}/g" /tmp/nginx-default.conf > /etc/nginx/conf.d/default.conf \
&& rm -f /tmp/nginx-default.conf && rm -f /tmp/nginx-default.conf
COPY --from=build /web/build /usr/share/nginx/html COPY --from=web-artifacts /web/build /usr/share/nginx/html