Skip to content

Commit

Permalink
add container build for arm (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrai2 authored Aug 6, 2024
1 parent 1dab2e1 commit b032ba4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,32 @@ jobs:
build-container:
runs-on: ubuntu-latest
needs: deploy
strategy:
fail-fast: false
matrix:
platform:
- amd64
- arm64
env:
REGISTRY_IMAGE: shiny_invoice
permissions:
packages: write
contents: read
steps:
- name: Prepare
run: |
platform=linux/${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v2
with:
Expand All @@ -55,6 +76,8 @@ jobs:
with:
context: .
push: true
platforms: linux/${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
ghcr.io/${{ github.repository_owner }}/shiny_invoice:${{ github.ref_name }}
ghcr.io/${{ github.repository_owner }}/shiny_invoice:latest
ghcr.io/${{ github.repository_owner }}/${{ env.REGISTRY_IMAGE }}:${{ matrix.platform }}-${{ github.ref_name }}
ghcr.io/${{ github.repository_owner }}/${{ env.REGISTRY_IMAGE }}:${{ matrix.platform }}-latest
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
FROM python:3.12-slim as compiler
FROM python:3.12-slim AS compiler
LABEL authors="dtrai2"

ENV PYTHONUNBUFFERED 1
ENV PYTHONUNBUFFERED=1
WORKDIR /home/app/
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install -U shiny-invoice

FROM python:3.12-slim as runner
FROM python:3.12-slim AS runner
LABEL authors="dtrai2"

WORKDIR /home/app/
COPY --from=compiler /opt/venv /opt/venv
COPY shiny_invoice/templates/ /home/app/templates/
ENV PATH="/opt/venv/bin:$PATH"
EXPOSE 8000
ENTRYPOINT ["shiny-invoice"]

0 comments on commit b032ba4

Please sign in to comment.