Build all supported Poetry versions in CI.

This commit adds a build matrix
(https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs)
to build all the latest stable versions of Poetry across all versions of
Python that Poetry supports.
pull/1/head
Joseph Hale 2 years ago
parent 4b2144b172
commit 2486ca8bc7

@ -22,4 +22,26 @@ jobs:
- name: Login to DockerHub
run: echo -n $DOCKER_ACCESS_TOKEN | docker login $DOCKER_REGISTRY -u $DOCKER_USERNAME --password-stdin
- name: Push Image to DockerHub
run: docker push jhale1805/python-poetry:1.1.13-py3.8.13-slim
run: docker push jhale1805/python-poetry:latest
build-versions:
runs-on: ubuntu-latest
strategy:
matrix:
python_image_tag: ["3.7-slim", "3.8-slim", "3.9-slim", "3.10-slim"]
poetry_version: ["1.0.10", "1.1.13"]
steps:
- uses: actions/checkout@v3
- name: Build the Docker Image
run: >
make build-version \
POETRY_VERSION=${{ matrix.poetry_version }} \
PYTHON_IMAGE_TAG=${{ matrix.python_image_tag }}
- name: Login to DockerHub
run: echo -n $DOCKER_ACCESS_TOKEN | docker login $DOCKER_REGISTRY -u $DOCKER_USERNAME --password-stdin
- name: Push Image to DockerHub
run: docker push jhale1805/python-poetry:${{ matrix.poetry_version }}-py${{ matrix.python_image_tag }}

@ -3,14 +3,15 @@
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
ARG PYTHON_IMAGE_TAG=3.8.13-slim
# Default to the latest slim version of Python
ARG PYTHON_IMAGE_TAG=slim
###############################################################################
# POETRY BASE IMAGE - Provides environment variables for poetry
###############################################################################
FROM python:${PYTHON_IMAGE_TAG} AS python-poetry-base
ARG POETRY_VERSION=1.1.13
# Default to the latest version of Poetry
ARG POETRY_VERSION=""
ENV POETRY_VERSION=${POETRY_VERSION}
ENV POETRY_HOME="/opt/poetry"

@ -3,14 +3,18 @@
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
POETRY_VERSION=1.1.13
PYTHON_IMAGE_TAG=3.8.13-slim
build:
docker build \
--tag jhale1805/python-poetry:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from jhale1805/python-poetry:latest \
.
build-version:
docker build \
--tag jhale1805/python-poetry:$(POETRY_VERSION)-py$(PYTHON_IMAGE_TAG) \
--build-arg POETRY_VERSION=$(POETRY_VERSION) \
--build-arg PYTHON_IMAGE_TAG=$(PYTHON_IMAGE_TAG) \
--tag jhale1805/python-poetry:$(POETRY_VERSION)-py$(PYTHON_IMAGE_TAG) \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from jhale1805/python-poetry:$(POETRY_VERSION)-py$(PYTHON_IMAGE_TAG) \
.
run:
docker run --rm --name poetry poetry poetry --version

@ -4,14 +4,44 @@
This software is released under the MIT License.
https://opensource.org/licenses/MIT
-->
# [Python Poetry](https://github.com/python-poetry/poetry) in Docker
Robust, lightweight, configurable `python-poetry` Docker images for any use
case.
A robust, configurable `python-poetry` Docker image.
*NOTE: This repository is **not** an official project from the creators of
Python Poetry. Hopefully you find it useful anyway!*
## Build
You can build this `python-poetry` image yourself using any version of Poetry
and Python.
## Quickstart
Most of the time, you will be using these images as a base image for your own
Dockerfiles (e.g. devcontainers, building Python applications, etc.)
```Dockerfile
FROM jhale1805/python-poetry
# Your build steps here.
```
However, you can also download and run the latest `python-poetry` Docker image
by pulling it from DockerHub.
```
docker pull jhale1805/python-poetry
docker run --rm jhale1805/python-poetry poetry --version
```
There are tagged images for all the latest stable versions of `python-poetry`
for all versions of Python that Poetry supports (>3.7). You can see the [full
tag list on DockerHub](https://hub.docker.com/r/jhale1805/python-poetry/tags).
## Build Your Own Image
This repo automatically builds images for the latest stable versions of
`python-poetry` for all supported versions of Python (>3.7).
- You can see the full build matrix in
[.github/workflows/docker-image.yml](.github/workflows/docker-image.yml)
However, if you need a combination that isn't automatically built, you can
easily create your own by modifying the command below to contain your preferred
values for `POETRY_VERSION` and `PYTHON_IMAGE_TAG`:
```bash
make build POETRY_VERSION="1.1.13" PYTHON_IMAGE_TAG="3.8.13-slim"
make build-version \
POETRY_VERSION="1.1.13" \
PYTHON_IMAGE_TAG="3.10-slim"
```

Loading…
Cancel
Save