Skip to content

Commit

Permalink
chore(ci): Use arm runner for production workflow and remove caching (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixpereira authored Feb 5, 2025
1 parent febfc3a commit bf018ac
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build:
needs: lint-format
name: Build
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
environment: Production
permissions:
id-token: write
Expand All @@ -34,35 +34,15 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up QEMU for ARM64
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64

- 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: Build Docker container
env:
PRODUCTION_BUILD: 'true'
run: |
docker buildx build \
--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 All @@ -82,9 +62,9 @@ jobs:
run: |
echo "$KEY" > private_key && chmod 600 private_key
ssh -v -o StrictHostKeyChecking=no -i private_key ${USER}@${HOSTNAME} '
cd ~/website
aws s3 cp s3://${{ secrets.AWS_S3_BUCKET }}/website/csclub-website.tar.gz .
aws s3 cp s3://${{ secrets.AWS_S3_BUCKET }}/website/docker-compose.yml .
docker load -i csclub-website.tar.gz
docker compose up -d
cd ~/website
aws s3 cp s3://${{ secrets.AWS_S3_BUCKET }}/website/csclub-website.tar.gz .
aws s3 cp s3://${{ secrets.AWS_S3_BUCKET }}/website/docker-compose.yml .
docker load -i csclub-website.tar.gz
docker compose up -d
'

0 comments on commit bf018ac

Please sign in to comment.