Skip to content

Commit

Permalink
Merge pull request #255 from Wizarrrr/v3-beta
Browse files Browse the repository at this point in the history
V3 beta
  • Loading branch information
Ashley Bailey authored Oct 15, 2023
2 parents 830909b + 13c03e8 commit 02cb4b5
Show file tree
Hide file tree
Showing 78 changed files with 2,973 additions and 713 deletions.
3 changes: 0 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ venv/
node_modules
__pycache__

# All hidden files
.*

Dockerfile
README.md
babel.cfg
Expand Down
251 changes: 237 additions & 14 deletions .github/workflows/beta-ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,276 @@
name: Docker Build and Push
name: Docker Build and Push Beta

on:
push:
branches:
- v3-beta
- "v3-beta"
workflow_dispatch: {}

permissions:
packages: write

env:
REGISTRY: ghcr.io
GHCR_REGISTRY: ghcr.io
DH_REGISTRY: docker.io
IMAGE_NAME: wizarrrr/wizarr
IMAGE_TAG: v3-beta

jobs:
build:
clear:
runs-on: ubuntu-latest
steps:
# Clear the digests from the artifacts
- name: Clear digests
uses: geekyeggo/delete-artifact@v2
with:
name: |
digests_dh
digests_ghcr
build_ghcr:
name: Build Digest for GHCR
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64

steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v4

# Get the Metadata from the Docker Image
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

# Set up QEMU
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# platforms: ${{ matrix.platform }}

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

# Login to GHCR
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build and push the image
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
outputs: type=image,name=${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true
cache-from: type=gha,scope=${{ matrix.platform }}-${{ env.GHCR_REGISTRY }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}-${{ env.GHCR_REGISTRY }}

# Export the digest for later use
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
# Upload the digest as an artifact
- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests_ghcr
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge_ghcr:
name: Merge Digest for GHCR
runs-on: ubuntu-latest
needs:
- build_ghcr
steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v2

# Get the Release Version from .github/latest
# Get the Release Version from latest
- name: Get the Release Version from latest
id: get_version
run: echo "::set-output name=version::$(cat latest)"

# Download the digests from the artifacts
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests_ghcr
path: /tmp/digests

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

# Get the Metadata from the Docker Image
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

# Login to GHCR
- name: Login to GHCR
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Create manifest list and push
- name: Create manifest list and push to Registry
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
--tag ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
--tag ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-${{ steps.get_version.outputs.version }} \
$(printf '${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
# Inspect image
- name: Inspect image
run: docker buildx imagetools inspect ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

build_dh:
name: Build Digest for Docker Hub
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64

steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v4

# Get the Metadata from the Docker Image
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

# Set up QEMU
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# platforms: ${{ matrix.platform }}

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

# Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.DH_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Build and push the image
- name: Build and push
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-${{ steps.get_version.outputs.version }}
platforms: linux/amd64,linux/arm64
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
outputs: type=image,name=${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true
cache-from: type=gha,scope=${{ matrix.platform }}-${{ env.GHCR_REGISTRY }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}-${{ env.GHCR_REGISTRY }}

# Export the digest for later use
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
# Upload the digest as an artifact
- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests_dh
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge_dh:
name: Merge Digest for Docker Hub
runs-on: ubuntu-latest
needs:
- build_dh
steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v2

# Get the Release Version from latest
- name: Get the Release Version from latest
id: get_version
run: echo "::set-output name=version::$(cat latest)"

# Download the digests from the artifacts
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests_dh
path: /tmp/digests

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

# Get the Metadata from the Docker Image
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

# Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Create manifest list and push
- name: Create manifest list and push to Registry
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
--tag ${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
--tag ${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-${{ steps.get_version.outputs.version }} \
$(printf '${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
# Inspect image
- name: Inspect image
run: docker buildx imagetools inspect ${{ env.DH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
Loading

0 comments on commit 02cb4b5

Please sign in to comment.