Skip to content

Commit

Permalink
docker: Attempt to improve build times by changing cache backend
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Apr 26, 2024
1 parent b4c7de2 commit 5d805e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Dockerfile
docker/Dockerfile
.dockerignore
node_modules
**/node_modules
npm-debug.log
README.md
**/.next
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
strategy:
matrix:
package: [web, workers, cli]
arch: [linux/amd64, linux/arm64]
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -35,11 +36,11 @@ jobs:
build-args: SERVER_VERSION=nightly
file: docker/Dockerfile
target: ${{ matrix.package }}
platforms: linux/amd64,linux/arm64
platforms: ${{ matrix.arch }}
push: true
tags: ghcr.io/mohamedbassem/hoarder-${{ matrix.package }}:latest
cache-from: type=registry,ref=ghcr.io/mohamedbassem/hoarder-build-cache:${{ matrix.package }}
cache-to: type=registry,mode=max,ref=ghcr.io/mohamedbassem/hoarder-build-cache:${{ matrix.package }}
cache-from: type=gha,scope=${{ matrix.package }}_${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.package }}_${{ matrix.arch }}

- name: Build ${{ matrix.package }} (release)
uses: docker/build-push-action@v5
Expand All @@ -49,8 +50,8 @@ jobs:
build-args: SERVER_VERSION=${{ github.event.release.name }}
file: docker/Dockerfile
target: ${{ matrix.package }}
platforms: linux/amd64,linux/arm64
platforms: ${{ matrix.arch }}
push: true
tags: ghcr.io/mohamedbassem/hoarder-${{ matrix.package }}:${{ github.event.release.name }},ghcr.io/mohamedbassem/hoarder-${{ matrix.package }}:release
cache-from: type=registry,ref=ghcr.io/mohamedbassem/hoarder-build-cache:${{ matrix.package }}
cache-to: type=registry,mode=max,ref=ghcr.io/mohamedbassem/hoarder-build-cache:${{ matrix.package }}
cache-from: type=gha,scope=${{ matrix.package }}_${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.package }}_${{ matrix.arch }}

0 comments on commit 5d805e2

Please sign in to comment.