Skip to content

Commit

Permalink
Update build CI to use PyDis specific config
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Nov 2, 2024
1 parent b383e77 commit 7e1327e
Showing 1 changed file with 12 additions and 55 deletions.
67 changes: 12 additions & 55 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,82 +4,39 @@ on:
workflow_call:

jobs:
build-base:
name: Build & push base image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker image metadata
uses: docker/metadata-action@v4
id: meta
with:
images: ghcr.io/supakeen/pinnwand
tags: |
type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Containerfile
target: base
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
cache-from: type=registry,ref=ghcr.io/supakeen/pinnwand:latest
cache-to: type=inline
tags: ${{ steps.meta.outputs.tags }}

build-additional-images:
build-image:
name: Build & push additional images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container-stage: ["psql","mysql"]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Github Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker image metadata
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/supakeen/pinnwand
images: ghcr.io/python-discord/pinnwand
tags: |
type=ref,event=tag,suffix=-${{ matrix.container-stage }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=raw,value=latest-${{ matrix.container-stage }}
type=ref,event=tag,suffix=psql
type=raw,value=latest-psql
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ./Containerfile
target: ${{ matrix.container-stage }}
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
cache-from: type=registry,ref=ghcr.io/supakeen/pinnwand:latest-${{ matrix.container-stage }}
target: psql
push: true
cache-from: type=registry,ref=ghcr.io/python-discord/pinnwand:latest-psql
cache-to: type=inline
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit 7e1327e

Please sign in to comment.