feat(docker): streamline frontend build process and update Docker configuration

- Added a new script `build_frontend_dist.sh` to handle the building of frontend static assets.
- Updated `docker-compose.yml` to include a note about running the build script before building the frontend service.
- Modified the GitHub Actions workflow to integrate the new build script for frontend assets.
- Adjusted the Dockerfile to copy built assets directly from the `dist` directory.
- Refined the `.dockerignore` to exclude unnecessary files while keeping the `dist` directory.
This commit is contained in:
wizardchen
2026-06-10 16:02:39 +08:00
committed by lyingbug
parent fc98f000d8
commit 1c31d649a7
7 changed files with 56 additions and 57 deletions
+23 -8
View File
@@ -10,6 +10,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
NODE_VERSION: "24"
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
build-ui:
runs-on: ubuntu-latest
@@ -17,6 +21,25 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6
- name: Prepare version info
id: version
run: |
eval "$(./scripts/get_version.sh env)"
echo "commit_id=$COMMIT_ID" >> $GITHUB_OUTPUT
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Build frontend
env:
VITE_IS_DOCKER: true
VITE_FRONTEND_COMMIT: ${{ steps.version.outputs.commit_id }}
run: ./scripts/build_frontend_dist.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
@@ -32,12 +55,6 @@ jobs:
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-ui
- name: Prepare version info
id: version
run: |
eval "$(./scripts/get_version.sh env)"
echo "commit_id=$COMMIT_ID" >> $GITHUB_OUTPUT
- name: Build ui Image
uses: docker/build-push-action@v7
with:
@@ -45,8 +62,6 @@ jobs:
platforms: linux/amd64,linux/arm64
file: frontend/Dockerfile
context: ./frontend
build-args: |
${{ format('COMMIT_ID_ARG={0}', steps.version.outputs.commit_id) }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha,scope=build-ui