🚀 Use ghcr-hosted images for prod deployment #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push openresty Docker image | |
on: | |
push: | |
branches: | |
- axel/nixos | |
- master | |
paths: | |
- 'frontend/**' | |
- 'openresty/**' | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push frontend | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/receptdatabasen-frontend:latest | |
ghcr.io/${{ github.repository_owner }}/receptdatabasen-frontend:${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64 #,linux/arm64 - temporarily disabled due to issues with the frontend build | |
build-and-push-openresty: | |
needs: build-frontend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push openresty | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./openresty | |
file: ./openresty/Dockerfile | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/receptdatabasen-openresty:latest | |
ghcr.io/${{ github.repository_owner }}/receptdatabasen-openresty:${{ github.sha }} | |
platforms: linux/amd64 # ,linux/arm64 -- temporarily disabled due to issues with the frontend build |