Skip to content

feat: Enhance project configuration and add new features #3

feat: Enhance project configuration and add new features

feat: Enhance project configuration and add new features #3

Workflow file for this run

name: Docker Build
on:
push:
branches: [main, develop]
paths: ['src/**', 'web/**', 'Dockerfile*']
pull_request:
branches: [main, develop]
paths: ['src/**', 'web/**', 'Dockerfile*']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: npm
cache-dependency-path: 'web/package-lock.json'
- name: Install and build
working-directory: ./web
run: |
npm ci
npm run build
- uses: actions/upload-artifact@v4
with:
name: frontend-build
path: web/dist/
docker-build:
runs-on: ubuntu-latest
needs: build-frontend
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: frontend-build
path: web/dist/
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max