From 8025474a34c2639c902871d312160f8807ec1c5e Mon Sep 17 00:00:00 2001 From: Lukas Jost Date: Wed, 25 Sep 2024 22:43:42 +0200 Subject: [PATCH 1/4] feat: Build ARM compatible docker image --- .github/workflows/release.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6ef46e..4b11d7a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,16 +35,30 @@ jobs: if: needs.release.outputs.new-release-published == 'true' steps: - uses: actions/checkout@v3 + - uses: docker/metadata-action@v5 + name: Docker meta + id: meta + with: + images: | + ghcr.io/${{ github.repository }} + tags: | + type=semver,pattern={{major}}.{{minor}}.{{patch}} - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image - run: | - docker build --build-arg BUILD_VERSION=${{ needs.release.outputs.new-release-version }} VERSION=${{ needs.release.outputs.new-release-version }} \ - -t ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} \ - -t ghcr.io/${{ github.repository }}:latest . - docker push ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} + - name: Build and push + id: docker-build + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + build-args: + - BUILD_VERSION=${{ needs.release.outputs.new-release-version }} + - VERSION=${{ needs.release.outputs.new-release-version }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From b0d4e6a3f1c80cc8f497a449df89df300a3da397 Mon Sep 17 00:00:00 2001 From: Lukas Jost Date: Wed, 27 Nov 2024 09:49:09 +0100 Subject: [PATCH 2/4] fix: Remove build-args configuration from release.yml --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b11d7a..d334bb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,9 +56,6 @@ jobs: context: . platforms: linux/amd64,linux/arm64 push: true - build-args: - - BUILD_VERSION=${{ needs.release.outputs.new-release-version }} - - VERSION=${{ needs.release.outputs.new-release-version }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max From 44a09f33dab9e391c744ee334a03892cccc00565 Mon Sep 17 00:00:00 2001 From: sai80082 Date: Sat, 30 Nov 2024 14:56:22 +0530 Subject: [PATCH 3/4] ci: updated workflow --- .github/workflows/release.yml | 10 ++++++++-- Dockerfile | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d334bb3..2394faf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,8 @@ on: jobs: release: + # Only run on the original repository, not forks + if: ${{ github.repository_owner == 'varun-raj' }} runs-on: ubuntu-latest permissions: contents: write @@ -32,7 +34,7 @@ jobs: contents: read packages: write needs: release - if: needs.release.outputs.new-release-published == 'true' + if: always() && !failure() steps: - uses: actions/checkout@v3 - uses: docker/metadata-action@v5 @@ -42,7 +44,8 @@ jobs: images: | ghcr.io/${{ github.repository }} tags: | - type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=raw,value=latest,enable=${{ github.repository_owner != 'varun-raj' || needs.release.outputs.new-release-published == 'true' }} + type=semver,pattern={{major}}.{{minor}}.{{patch}},enable=${{ github.repository_owner == 'varun-raj' && needs.release.outputs.new-release-published == 'true' }} - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: @@ -56,6 +59,9 @@ jobs: context: . platforms: linux/amd64,linux/arm64 push: true + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + VERSION=${{ needs.release.outputs.new-release-version || 'dev' }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 629fe2f..a295930 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,11 @@ RUN npm run build # Production image, copy all the files and run next FROM node:18-alpine AS runner WORKDIR /app +# Define a build argument +ARG VERSION=dev + +# Set the build argument as an environment variable +ENV VERSION=$VERSION ENV NODE_ENV=production From ca9260912c742a2a681b5a79395d8c2396a91df7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 30 Nov 2024 11:46:37 +0000 Subject: [PATCH 4/4] chore(release): 0.9.0 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🚀 **Immich Power Tools** 0.9.0 ### Bug Fixes * Remove build-args configuration from release.yml ([b0d4e6a](https://github.com/varun-raj/immich-power-tools/commit/b0d4e6a3f1c80cc8f497a449df89df300a3da397)) ### Features * Build ARM compatible docker image ([8025474](https://github.com/varun-raj/immich-power-tools/commit/8025474a34c2639c902871d312160f8807ec1c5e)) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b01e46..559ea27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "immich-power-tools", - "version": "0.8.0", + "version": "0.9.0", "private": true, "scripts": { "dev": "next dev",