diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..2ed3c18 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,42 @@ +name: Docker +on: + push: + branches: [ "master" ] + +jobs: + build: + name: "Build (${{ matrix.component }})" + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + component: [frontend, backend] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GH_TOKEN }} + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: ${{ matrix.component }} + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64 + file: ${{ matrix.component }}/Dockerfile + tags: | + ghcr.io/csesoc/subcomp-${{ matrix.component }}:${{ github.sha }} + ghcr.io/csesoc/subcomp-${{ matrix.component }}:latest + labels: ${{ steps.meta.outputs.labels }}