Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(ci) Use Github runner #52

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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