From 36fc510d3acaf4b17e083bc9045f310b014fc790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 5 Mar 2024 03:15:20 +0100 Subject: [PATCH] [docker] update workflow - run on every push to master - build images from GitHub source instead of PyPI package - build arm64 image (#5227) - include more tags - build date as 'YYYYMMDD' - 'dev' for most recent build from master - 'latest' for most recent release build --- .github/workflows/docker.yml | 60 ++++++++++++++++++++---------------- Dockerfile | 2 +- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1abff80c..46e67a4e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,33 +1,47 @@ -name: docker +name: Docker Images on: workflow_dispatch: push: + branches: + - master tags: - v[0-9]+.[0-9]+.[0-9]+ + permissions: packages: write +concurrency: + group: docker + cancel-in-progress: false + jobs: - docker: + build: runs-on: ubuntu-latest + # on release commits, run only for tag event + if: ${{ ! startsWith( github.event.head_commit.message , 'release version ' ) || startsWith( github.ref , 'refs/tags/v' ) }} + steps: - uses: actions/checkout@v4 - # https://github.com/docker/setup-buildx-action - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # https://github.com/docker/login-action - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 + - uses: docker/metadata-action@v5 + id: metadata with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + images: | + mikf123/gallery-dl + ghcr.io/mikf/gallery-dl + tags: | + type=ref,event=tag + type=raw,value=dev + type=sha,format=long,prefix= + type=raw,priority=500,value={{date 'YYYYMMDD'}} + + - uses: docker/setup-qemu-action@v3 + + - uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 @@ -35,23 +49,17 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - # https://github.com/docker/metadata-action - - name: Generate Docker tags - uses: docker/metadata-action@v5 - id: metadata + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - images: | - mikf123/gallery-dl - ghcr.io/mikf/gallery-dl - tags: | - type=sha,format=long,prefix= - type=ref,event=tag + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} - # https://github.com/docker/build-push-action - - name: Build image - uses: docker/build-push-action@v5 + - uses: docker/build-push-action@v5 with: + context: . push: true tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 diff --git a/Dockerfile b/Dockerfile index 26c0d850..81bd8c12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN : \ && python3 -B -m pip --no-cache-dir --no-input --disable-pip-version-check install -U \ pip \ && python3 -B -m pip --no-cache-dir --no-input --disable-pip-version-check install -U \ - gallery-dl \ + https://github.com/mikf/gallery-dl/archive/refs/heads/master.tar.gz \ yt-dlp \ && rm -rf /root/.cache/pip \ && :