Skip to content

Commit

Permalink
Add Docker-based multiarch support for amd64 and arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
nemuelw committed Nov 11, 2024
1 parent e989764 commit 60fcc34
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,34 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker image
run: |
poetry install
docker build --platform linux/${{ matrix.arch }} -t protodesk .
- name: Run Pyinstaller
- name: Run Docker image
run: |
poetry run pyinstaller app.spec
docker run --rm -v $(pwd)/dist:/app/dist --name protodesk-container protodesk
- name: Create a versioned archive of the build
run: |
cd dist && tar -czf protodesk-${{ github.event.release.tag_name }}.tar.gz app/
cd dist && tar -czf protodesk-${{ github.event.release.tag_name }}_${{ matrix.arch }}.tar.gz app/
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url}}
asset_path: dist/protodesk-${{ github.event.release.tag_name }}.tar.gz
asset_name: protodesk-${{ github.event.release.tag_name }}.tar.gz
asset_path: dist/protodesk-${{ github.event.release.tag_name }}_${{ matrix.arch }}.tar.gz
asset_name: protodesk-${{ github.event.release.tag_name }}_${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# base image
FROM python:3.12-slim

# working directory
WORKDIR /app

# install poetry
RUN curl -sSL https://install.python-poetry.org | python3 -

# copy project files
COPY . /app

# install project dependencies
RUN poetry install --no-root

# build the application with Pyinstaller
RUN poetry run pyinstaller app.spec

0 comments on commit 60fcc34

Please sign in to comment.