Skip to content

Commit

Permalink
build(ci) Use Github runner (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixpereira authored Sep 2, 2024
1 parent d1a3295 commit cbb82fc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
29 changes: 27 additions & 2 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: [self-hosted, ARM64] # Since deployment is on arm64
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
Expand All @@ -30,12 +30,37 @@ jobs:
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}

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

- 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: Build Docker container
run: |
docker buildx build \
--platform=linux/arm64 --file=Dockerfile -t duckbot .
--platform=linux/arm64 \
--tag duckbot:latest \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \
--file=Dockerfile .
docker image save duckbot | gzip > duckbot.tar.gz
- 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 ./duckbot.tar.gz s3://${{ secrets.AWS_S3_BUCKET }}/duckbot/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base image
FROM python:3.11-slim as base
FROM python:3.11-slim AS base

WORKDIR /app

Expand Down

0 comments on commit cbb82fc

Please sign in to comment.