fix: simplify Docker build workflow, remove PREBUILT artifact workaround
All checks were successful
All checks were successful
- Remove UI build artifact upload/download steps (18 lines removed) - Remove .dockerignore manipulation workaround - Always build UI from source inside Docker (more reliable) - Remove PREBUILT arg from ui/Dockerfile and docker-bake.hcl This fixes the '/app/build not found' error in CI by eliminating the fragile artifact-passing mechanism. UI now builds fresh in Docker using build cache, same as local development.
This commit is contained in:
@@ -55,13 +55,6 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Upload build artifacts
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ui-build
|
|
||||||
path: ui/build
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
# ── docker: build + push all images via docker bake ──────────────────────────
|
# ── docker: build + push all images via docker bake ──────────────────────────
|
||||||
docker:
|
docker:
|
||||||
name: Docker
|
name: Docker
|
||||||
@@ -86,17 +79,6 @@ jobs:
|
|||||||
echo "version=$VER" >> "$GITHUB_OUTPUT"
|
echo "version=$VER" >> "$GITHUB_OUTPUT"
|
||||||
echo "major_minor=$(echo "$VER" | cut -d. -f1-2)" >> "$GITHUB_OUTPUT"
|
echo "major_minor=$(echo "$VER" | cut -d. -f1-2)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Download ui build artifacts
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ui-build
|
|
||||||
path: ui/build
|
|
||||||
|
|
||||||
- name: Allow build/ into Docker context (override .dockerignore)
|
|
||||||
run: |
|
|
||||||
grep -v '^build$' ui/.dockerignore > ui/.dockerignore.tmp
|
|
||||||
mv ui/.dockerignore.tmp ui/.dockerignore
|
|
||||||
|
|
||||||
- name: Build and push all images
|
- name: Build and push all images
|
||||||
uses: docker/bake-action@v6
|
uses: docker/bake-action@v6
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
# docker-bake.hcl — defines all five production images.
|
# docker-bake.hcl — defines all five production images.
|
||||||
#
|
#
|
||||||
# Uses only plain variables for broad buildx compatibility (no locals/functions).
|
# CI passes version info as environment variables; locally everything gets :dev tags.
|
||||||
# CI pre-computes VERSION and MAJOR_MINOR from the git tag and passes them as
|
|
||||||
# env vars. Locally, everything gets a :dev tag.
|
|
||||||
#
|
#
|
||||||
# Local build (no push):
|
# Local build (no push):
|
||||||
# docker buildx bake
|
# docker buildx bake
|
||||||
#
|
#
|
||||||
# CI passes: DOCKER_USER, VERSION, MAJOR_MINOR, COMMIT, BUILD_TIME
|
# CI environment variables: VERSION, MAJOR_MINOR, COMMIT, BUILD_TIME
|
||||||
|
|
||||||
variable "DOCKER_USER" { default = "kalekber" }
|
variable "DOCKER_USER" { default = "kalekber" }
|
||||||
variable "VERSION" { default = "dev" } # e.g. "4.1.6" (no leading v)
|
variable "VERSION" { default = "dev" } # e.g. "4.1.6" (no leading v)
|
||||||
@@ -85,7 +83,6 @@ target "ui" {
|
|||||||
BUILD_VERSION = VERSION
|
BUILD_VERSION = VERSION
|
||||||
BUILD_COMMIT = COMMIT
|
BUILD_COMMIT = COMMIT
|
||||||
BUILD_TIME = BUILD_TIME
|
BUILD_TIME = BUILD_TIME
|
||||||
PREBUILT = "1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,7 @@ ENV PUBLIC_BUILD_VERSION=$BUILD_VERSION
|
|||||||
ENV PUBLIC_BUILD_COMMIT=$BUILD_COMMIT
|
ENV PUBLIC_BUILD_COMMIT=$BUILD_COMMIT
|
||||||
ENV PUBLIC_BUILD_TIME=$BUILD_TIME
|
ENV PUBLIC_BUILD_TIME=$BUILD_TIME
|
||||||
|
|
||||||
# PREBUILT=1 skips npm run build — used in CI when the build/ directory has
|
RUN npm run build
|
||||||
# already been compiled (and debug IDs injected) by a prior job. The caller
|
|
||||||
# must copy the pre-built build/ into the Docker context before building.
|
|
||||||
ARG PREBUILT=0
|
|
||||||
RUN [ "$PREBUILT" = "1" ] || npm run build
|
|
||||||
|
|
||||||
# ── Runtime image ──────────────────────────────────────────────────────────────
|
# ── Runtime image ──────────────────────────────────────────────────────────────
|
||||||
# adapter-node bundles most server-side code, but packages with dynamic
|
# adapter-node bundles most server-side code, but packages with dynamic
|
||||||
|
|||||||
Reference in New Issue
Block a user