diff --git a/.dockerignore b/.dockerignore index d298e8b..a62dbd2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,4 @@ node_modules -dist .git .env .DS_Store diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index 5e407ec..823f182 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -22,8 +22,15 @@ jobs: uses: actions/checkout@v4 - name: Install JS dependencies run: npm install + - name: Run prepare scripts + run: sh scripts/prepare_release.sh - name: Run build run: npm run build + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ build_vision_start: name: Build Vision Start Image @@ -33,6 +40,12 @@ jobs: - name: Check out repository uses: actions/checkout@v2 + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + - name: Log in to Container Registry run: | echo "${{ secrets.REGISTRY_PASSWORD }}" \ diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 95a891b..f954124 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -23,16 +23,21 @@ jobs: run: sudo apt-get install zip jq curl -y - name: Install JS dependencies run: npm install + - name: Prepare release + run: bash scripts/prepare_release.sh - name: Run build run: npm run build - - name: Prepare release + - name: Upload dist artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist/ + - name: Package release zip run: | - bash scripts/prepare_release.sh - mv dist vision-start/ - mv manifest.json vision-start/ - - name: Create zip archive - run: zip -r vision-start-${{ gitea.ref_name }}.zip vision-start - - name: Upload artifact + cp -r dist vision-start/ + cp manifest.json vision-start/ + zip -r vision-start-${{ gitea.ref_name }}.zip vision-start + - name: Upload release zip artifact uses: actions/upload-artifact@v3 with: name: release-zip @@ -103,6 +108,12 @@ jobs: - name: Check out repository uses: actions/checkout@v2 + - name: Download dist artifact + uses: actions/download-artifact@v3 + with: + name: dist + path: dist/ + - name: Log in to Container Registry run: | echo "${{ secrets.REGISTRY_PASSWORD }}" \ diff --git a/Dockerfile b/Dockerfile index 5bfac58..1c13435 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,7 @@ -FROM node:22-alpine AS builder - -# Set working directory -WORKDIR /app - -# Copy package.json and package-lock.json (if available) -COPY package*.json ./ - -# Install dependencies -RUN npm install - -# Copy the rest of the application -COPY . . - -# Run prepare scripts to fetch required assets -RUN sh scripts/prepare_release.sh - -# Build the application -RUN npm run build - -# Production stage FROM nginx:alpine -# Copy the built application from the builder stage -COPY --from=builder /app/dist /usr/share/nginx/html +# Copy the pre-built application +COPY dist/ /usr/share/nginx/html/ # Copy the manifest.json COPY manifest.json /usr/share/nginx/html/