Merge pull request #6 from mdiluz/add-armv7-compat
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Test / build (push) Has been cancelled

Add armv7 compat
This commit is contained in:
Marc Di Luzio 2024-08-14 18:39:50 +01:00 committed by GitHub
commit e4baf2e7aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 5 deletions

View file

@ -6,10 +6,7 @@ on:
- main - main
tags: tags:
- '*' - '*'
pull_request: pull_request:
# temp while iterating
workflow_dispatch: workflow_dispatch:
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
@ -33,6 +30,11 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm32v7/armhf # arm64v8/aarch64 - no current need for arm64
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry - name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
@ -41,6 +43,11 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container # Use docker-container driver for multi-platform builds
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker - name: Extract metadata (tags, labels) for Docker
id: meta id: meta
@ -61,9 +68,12 @@ jobs:
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with: with:
context: . context: .
platforms: linux/arm/v7,linux/amd64 # linux/arm64 no current need for arm64
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)." # This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation - name: Generate artifact attestation

View file

@ -1,3 +1,10 @@
# Split out the wheel build into the non-slim image
# See https://github.com/docker-library/python/issues/869
FROM python:3.12 AS build
COPY requirements.txt ./
RUN --mount=type=cache,target=/var/cache/buildkit/pip \
pip wheel --wheel-dir /wheels -r requirements.txt
FROM python:3.12-slim FROM python:3.12-slim
LABEL org.opencontainers.image.source=https://github.com/mdiluz/matchy LABEL org.opencontainers.image.source=https://github.com/mdiluz/matchy
LABEL org.opencontainers.image.description="Matchy matches matchees" LABEL org.opencontainers.image.description="Matchy matches matchees"
@ -5,6 +12,9 @@ LABEL org.opencontainers.image.licenses=Unlicense
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY requirements.txt ./ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt COPY --from=build /wheels /wheels
RUN --mount=type=cache,target=/var/cache/buildkit/pip \
pip install --find-links /wheels --no-index -r requirements.txt
COPY . . COPY . .
CMD ["python", "py/matchy.py"] CMD ["python", "py/matchy.py"]