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
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:
@@ -8,7 +8,7 @@
|
||||
|------|--------|
|
||||
| 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-образа |
|
||||
| 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` |
|
||||
|
||||
Кэш registry (переменные bake):
|
||||
|
||||
@@ -65,7 +65,7 @@ group "go-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-образы ---
|
||||
@@ -202,13 +202,26 @@ target "web-deps" {
|
||||
cache-to = web-cache-to()
|
||||
}
|
||||
|
||||
target "evobgp-web" {
|
||||
target "web-build" {
|
||||
context = "../.."
|
||||
dockerfile = "deploy/docker/evobgp-web/Dockerfile"
|
||||
target = "build"
|
||||
platforms = ["linux/amd64"]
|
||||
contexts = {
|
||||
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" }
|
||||
cache-from = web-cache-from()
|
||||
cache-to = web-cache-to()
|
||||
@@ -216,8 +229,16 @@ target "evobgp-web" {
|
||||
}
|
||||
|
||||
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" }
|
||||
cache-from = web-cache-from()
|
||||
cache-to = web-cache-to()
|
||||
tags = image-tags("evobgp-web-all")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
# Статическая панель EvoBGP (SvelteKit) + nginx.
|
||||
# Финальный stage `web` ожидает bake-контекст web-artifacts (= target:web-build).
|
||||
FROM public.ecr.aws/docker/library/node:22-alpine AS deps
|
||||
WORKDIR /web
|
||||
COPY web/package.json web/package-lock.json ./
|
||||
@@ -10,9 +11,9 @@ FROM deps AS build
|
||||
COPY web/ ./
|
||||
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
|
||||
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 \
|
||||
&& 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
|
||||
|
||||
Reference in New Issue
Block a user