🐳 Build & Publish Docker Image #4
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
on: | |
workflow_dispatch: | |
inputs: | |
skip-cache: | |
type: boolean | |
description: Skip Cache | |
name: 🐳 Build & Publish Docker Image | |
jobs: | |
build-container: | |
strategy: | |
matrix: | |
arch: ["arm64", "amd64"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout | |
uses: actions/checkout@v4 | |
- name: 🤖 Setup Qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: "arm64" | |
- name: 🐋 Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: 🦥 Cache Image | |
id: cache-image | |
uses: actions/cache@v4 | |
with: | |
key: venmic-builder-cache-${{ matrix.arch }} | |
path: | | |
docker/venmic-builder-${{ matrix.arch }}.tar | |
- name: 🏗️ Build Image | |
if: steps.cache-image.outputs.cache-hit != 'true' && ${{ github.event.inputs.skip-cache != 'true' }} | |
run: | | |
cd docker | |
docker buildx build --platform=linux/${{ matrix.arch }} --tag venmic-builder-${{ matrix.arch }} --load . | |
docker save venmic-builder-${{ matrix.arch }} > venmic-builder-${{ matrix.arch }}.tar | |
- name: 🔐 Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: ♻️ Publish Images | |
run: | | |
docker load < docker/venmic-builder-${{ matrix.arch }}.tar | |
docker image tag venmic-builder-${{ matrix.arch }} ghcr.io/vencord/venmic-builder-${{ matrix.arch }} | |
docker push ghcr.io/vencord/venmic-builder-${{ matrix.arch }}:latest |