From d574bfccd1f0902f6c2586b5557a0873a6644c5f Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Mon, 11 Jul 2022 21:29:09 -0500 Subject: [PATCH] ci: Edge builds for the docker image A new `edge` tag will be published for docker builds resulting from relevant changes on `master`. This provides an opportunity for the community to test Docker-specific changes prior to the next release of Recyclarr itself. --- .github/workflows/docker.yml | 41 ++++++++++++++++++++++++------------ docker/Dockerfile | 4 +++- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4b6b11c8..d609a426 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,8 +6,8 @@ on: # Tags are explicitly ignored on push. We still want branches to be processed, but they won't if # the `branches` property is missing. See more detail here: # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore - tags-ignore: ['*'] - branches: ['*'] + tags-ignore: ["*"] + branches: ["*"] paths: - docker/** - .github/workflows/docker.yml @@ -18,7 +18,7 @@ on: - .github/workflows/docker.yml release: - types: [ published ] + types: [published] workflow_dispatch: inputs: @@ -33,7 +33,7 @@ on: type: boolean env: - SHOULD_PUBLISH: ${{ github.event_name == 'release' || inputs.should_publish == 'true' }} + SHOULD_PUBLISH: ${{ github.event_name == 'release' || inputs.should_publish == 'true' || github.event.push.ref == 'refs/heads/master' }} VERSION: ${{ github.event.release.tag_name || inputs.release_tag }} jobs: @@ -43,34 +43,47 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - - name: Extract Image Metadata + - name: Check if tag is a version number + id: check_version + run: | + regex="[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+" + if [[ '${{ env.VERSION }}' =~ $regex ]]; then + echo ::set-output name=match::true + else + echo ::set-output name=match::false + fi + + - name: Set Version Tags id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v4 + env: + SEMVER: type=semver,enable=${{ steps.check_version.outputs.match }},value=${{ env.VERSION }} with: images: ghcr.io/${{ github.repository }} tags: | - type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{ env.VERSION }} - type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }} - type=semver,pattern={{major}},value=${{ env.VERSION }} + type=edge,branch=master + ${{ env.SEMVER }},pattern={{major}}.{{minor}}.{{patch}} + ${{ env.SEMVER }},pattern={{major}}.{{minor}} + ${{ env.SEMVER }},pattern={{major}} - name: Login to GHCR if: env.SHOULD_PUBLISH - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build & Push Image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: ./docker push: ${{ env.SHOULD_PUBLISH }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 1ec2d19d..3fc0812b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -29,7 +29,9 @@ ENV RECYCLARR_APP_DATA=/config \ VOLUME /config -RUN apk add --no-cache busybox-suid su-exec libstdc++ tzdata; +RUN set -e; \ + apk add --no-cache busybox-suid su-exec libstdc++ tzdata; \ + mkdir -p "$DOTNET_BUNDLE_EXTRACT_BASE_DIR" && chmod 777 "$DOTNET_BUNDLE_EXTRACT_BASE_DIR" COPY --chmod=755 --from=build /build/recyclarr /usr/local/bin COPY --chmod=755 ./scripts/prod/*.sh /