Skip to content

Commit

Permalink
Merge pull request #34 from max-pfeiffer/feature/multi_arch_image
Browse files Browse the repository at this point in the history
Feature/multi arch image
  • Loading branch information
max-pfeiffer committed Jul 22, 2023
2 parents 242af3e + e31d414 commit f227aeb
Show file tree
Hide file tree
Showing 22 changed files with 911 additions and 612 deletions.
53 changes: 46 additions & 7 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ jobs:
pylint build tests
black --check .
run-tests:
run-build-image-tests:
needs: code-quality
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand All @@ -63,24 +63,63 @@ jobs:
- name: Run all tests with pytest
run: |
source .venv/bin/activate
pytest --cov
pytest tests/build_image --cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

run-publish-image-tests:
needs: code-quality
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.1
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Run all tests with pytest
run: |
source .venv/bin/activate
pytest tests/publish_image --cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

publish-all-images:
needs: run-tests
needs:
- run-build-image-tests
- run-publish-image-tests
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Get Git Commit Tag Name
uses: olegtarasov/[email protected]
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ management.
Basis of this image are the [official Python](https://hub.docker.com/_/python)
and [Debian images](https://hub.docker.com/_/debian).

This multiarch image supports AMD64 and ARM64 architectures.

**Docker Hub:** [pfeiffermax/python-poetry](https://hub.docker.com/r/pfeiffermax/python-poetry)

**GitHub Repository:** [https://github.com/max-pfeiffer/python-poetry](https://github.com/max-pfeiffer/python-poetry)
Expand All @@ -19,7 +21,7 @@ and [Debian images](https://hub.docker.com/_/debian).
**Poetry versions:**
* v1.3.2
* v1.4.2
* v1.5.0
* v1.5.1

**Python versions:**
* v3.9
Expand All @@ -29,3 +31,7 @@ and [Debian images](https://hub.docker.com/_/debian).
**Operating system:**
* [Debian Bullseye v10.13](https://www.debian.org/releases/bullseye/)
* [Debian Bullseye slim v10.13](https://www.debian.org/releases/bullseye/)

**CPU architectures**
* linux/amd64
* linux/arm64
117 changes: 0 additions & 117 deletions build/constants.py

This file was deleted.

39 changes: 39 additions & 0 deletions build/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
variable "REGISTRY" {
default = "docker.io"
}

variable "IMAGE_VERSION" {
default = null
}

variable "CONTEXT" {
default = "."
}

target "python-poetry" {
name = "poetry${replace(poetry_version, ".", "-")}-python${replace(python_version, ".", "-")}-${os_variant}"
context = CONTEXT

matrix = {
python_version = ["3.9.17", "3.10.12", "3.11.4"]
os_variant = ["bullseye", "slim-bullseye"]
poetry_version = ["1.3.2", "1.4.2", "1.5.1"]
}

args = {
POETRY_VERSION = poetry_version
OFFICIAL_PYTHON_IMAGE = "python:${python_version}-${os_variant}"
}

platforms = ["linux/amd64", "linux/arm64/v8"]

tags = ["${REGISTRY}/pfeiffermax/python-poetry:${IMAGE_VERSION}-poetry${poetry_version}-python${python_version}-${os_variant}"]

cache-to = [
"type=gha,mode=max"
]

cache-from = [
"type=gha"
]
}
56 changes: 0 additions & 56 deletions build/images.py

This file was deleted.

Loading

0 comments on commit f227aeb

Please sign in to comment.