bliss/.github/workflows/docker-build.yml

75 lines
1.7 KiB
YAML

name: Docker Image CI
on:
push:
branches: ['main']
paths:
- 'api/src/**'
- 'web/src/**'
- 'api/prisma/**'
- '.github/**'
- 'api/Dockerfile'
- 'web/Dockerfile'
- 'web/entrypoint.sh'
pull_request:
branches: ['main']
paths:
- 'api/src/**'
- 'web/src/**'
- 'api/prisma/**'
- '.github/**'
- 'api/Dockerfile'
- 'web/Dockerfile'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: api
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
id: qemu
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
id: buildx
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build api image and push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
context: ./api
file: ./api/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/renzynx/bliss:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Switch working directory
run: cd ../web
- name: Build web image and push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
context: ./web
file: ./web/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/renzynx/web:latest
cache-from: type=gha
cache-to: type=gha,mode=max