Skip to content

Commit

Permalink
fix(ci): Re-add caching and echo NEXT_PUBLIC_DRIVE_LINK to .env.local
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixpereira committed Feb 5, 2025
1 parent 7e9a60a commit cb8e4fc
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,33 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Echo NEXT_PUBLIC_DRIVE_LINK to .env.local
run: echo "NEXT_PUBLIC_DRIVE_LINK=${{ secrets.NEXT_PUBLIC_DRIVE_LINK }}" > .env.local

- name: Build Docker container
env:
NEXT_PUBLIC_DRIVE_LINK: ${{ secrets.NEXT_PUBLIC_DRIVE_LINK }}
PRODUCTION_BUILD: 'true'
run: |
docker buildx build \
--build-arg NEXT_PUBLIC_DRIVE_LINK=${{ secrets.NEXT_PUBLIC_DRIVE_LINK }} \
--output type=docker,dest=csclub-website.tar \
--platform=linux/arm64 --file=Dockerfile -t csclub-website .
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \
--output type=docker,dest=csclub-website.tar \
--platform=linux/arm64 --file=Dockerfile -t csclub-website .
gzip csclub-website.tar
- name: Save Docker cache
if: success()
run: |
rsync -a --delete /tmp/.buildx-cache-new/ /tmp/.buildx-cache/
- name: Copy image and compose file to S3
run: |
aws s3 cp ./csclub-website.tar.gz s3://${{ secrets.AWS_S3_BUCKET }}/website/
Expand Down

0 comments on commit cb8e4fc

Please sign in to comment.