Skip to content

Commit cb8e4fc

Browse files
fix(ci): Re-add caching and echo NEXT_PUBLIC_DRIVE_LINK to .env.local
1 parent 7e9a60a commit cb8e4fc

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/production.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,33 @@ jobs:
3434
- name: Set up Docker Buildx
3535
uses: docker/setup-buildx-action@v3
3636

37+
- name: Cache Docker layers
38+
uses: actions/cache@v4
39+
with:
40+
path: /tmp/.buildx-cache
41+
key: ${{ runner.os }}-buildx-${{ github.sha }}
42+
restore-keys: |
43+
${{ runner.os }}-buildx-
44+
45+
- name: Echo NEXT_PUBLIC_DRIVE_LINK to .env.local
46+
run: echo "NEXT_PUBLIC_DRIVE_LINK=${{ secrets.NEXT_PUBLIC_DRIVE_LINK }}" > .env.local
47+
3748
- name: Build Docker container
3849
env:
39-
NEXT_PUBLIC_DRIVE_LINK: ${{ secrets.NEXT_PUBLIC_DRIVE_LINK }}
4050
PRODUCTION_BUILD: 'true'
4151
run: |
4252
docker buildx build \
43-
--build-arg NEXT_PUBLIC_DRIVE_LINK=${{ secrets.NEXT_PUBLIC_DRIVE_LINK }} \
44-
--output type=docker,dest=csclub-website.tar \
45-
--platform=linux/arm64 --file=Dockerfile -t csclub-website .
53+
--cache-from=type=local,src=/tmp/.buildx-cache \
54+
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \
55+
--output type=docker,dest=csclub-website.tar \
56+
--platform=linux/arm64 --file=Dockerfile -t csclub-website .
4657
gzip csclub-website.tar
4758
59+
- name: Save Docker cache
60+
if: success()
61+
run: |
62+
rsync -a --delete /tmp/.buildx-cache-new/ /tmp/.buildx-cache/
63+
4864
- name: Copy image and compose file to S3
4965
run: |
5066
aws s3 cp ./csclub-website.tar.gz s3://${{ secrets.AWS_S3_BUCKET }}/website/

0 commit comments

Comments
 (0)