TL;DR
The pyaction container is a Python slim Docker container with the addition of the GitHub CLI, git, curl, and gpg. Its original motivation was to support developing GitHub Actions with Python, but pyaction can also be used for other purposes (e.g., as an alternate way of using the GitHub CLI). Due to several requests from pyaction users, who wanted to use it with earlier Python versions, we recently changed the tagging convention. The Docker tags for pulling pyaction now include tags specifying the version of Python, and optionally the version of the GitHub CLI that are included in the image. The pyaction container is published to both Docker Hub and the GitHub Container Registry.
The maintainers of pyaction are not affiliated with GitHub; and pyaction is an unofficial installation of the GitHub CLI.
Table of Contents:
- About the pyaction Docker Container
- New Tagging Convention
- Installing
- More Information
- Where You Can Find Me
About the pyaction Docker Container
The pyaction container is a Python slim image on top of which I've added curl, git, gpg, and the GitHub CLI.
The original motivation for pyaction was to support implementing GitHub Actions in Python as a container actions. Container actions enable implementing a GitHub Action in any language, one only needs a Docker container that includes the relevant language tools (e.g., interpreter, etc) and any other tools needed. To implement a GitHub Action in Python, this would require, at a minimum, Python. Thus, a Python slim image is used as the base of pyaction. A "slim" image is specifically used to keep the container small for faster loading from workflows. The GitHub CLI is then added to the container to enable interfacing with all things GitHub. The GitHub Actions framework itself has the GitHub CLI installed, however, container actions are limited to running only what is installed within the container itself. The pyaction container also has curl installed. Although GitHub Actions is the motivating usecase, pyaction is not limited to this case.
You can pull pyaction from either Docker Hub or the GitHub Container Registry.
New Tagging Convention
Previously, we were using Semantic Versioning for the Docker tags, with each version having a specific combination of Python version and GitHub CLI version. We started getting requests from users of pyaction images with current GitHub CLI and earlier versions of Python. For example, perhaps their application wasn't ready for the next version of Python.
So, to meet these requests, we changed the tagging convention, such that tags include the Python version and optionally the GitHub CLI version. And we started publishing images for older Python versions whenever GitHub releases a new version of the GitHub CLI. At the present time, pyaction supports Python 3.8, 3.9, 3.10, 3.11, 3.12, and 3.13. Images are tagged as follows:
- For the current version of Python (e.g.,
3.13.6
) and current version of GitHub CLI (e.g.,2.76.2
), all of the following tags are available and equivalent:latest
,3.13.6
,3.13
,3.13.6-gh-2.76.2
,3.13.6-gh-2.76
,3.13.6-gh-2
,3.13-gh-2.76.2
,3.13-gh-2.76
,3.13-gh-2
. - For prior versions of Python (
3.8
,3.9
,3.10
,3.11
,3.12
) and current version of GitHub CLI (2.76.2
), all of the following tags are available and equivalent:3.12
,3.12-gh-2.76.2
,3.12-gh-2.76
,3.12-gh-2
.
This tag scheme began with version 2.75.0
of the GitHub CLI. We don't support pyaction images with earlier versions of the GitHub CLI (other than via older images published with the prior tagging scheme).
This tag scheme began with Python 3.13.5
. Python patch level tags are not available for pyaction prior to Python 3.13.5
.
Installing
The pre-built image is hosted on both Docker Hub and the GitHub Container Registry. You can use it in the following ways.
Docker Pull Command
Pull the latest image from Docker Hub with the following (or replace the latest
tag with the desired version):
docker pull cicirello/pyaction:latest
Pull from the Github Container Registry with:
docker pull ghcr.io/cicirello/pyaction:latest
Use as a base image in a Dockerfile
Use as a base image in a Dockerfile (or replace the latest
tag with the desired version):
FROM cicirello/pyaction:latest
# The rest of your Dockerfile would go here.
Or you can use as a base image (via the Github Container Registry) with:
FROM ghcr.io/cicirello/pyaction:latest
# The rest of your Dockerfile would go here.
More Information
For more information about pyaction, see earlier posts here on DEV in this series, as well as an information page about pyaction on the web.
Please consider starring pyaction's GitHub repository, and even better using it to develop GitHub Actions, or just to use the GitHub CLI:
pyaction
Website for our GitHub Actions and tools for developing them: https://actions.cicirello.org/
Summary
This Docker image is designed to support implementing Github Actions with Python. It starts with the official python docker image as the base, which is a Debian OS. It specifically uses python:3-slim to keep the image size down for faster loading of Github Actions that use pyaction. On top of the base, we've installed curl gpg, git, and the GitHub CLI. We added curl and gpg because they are needed to install the GitHub CLI, and they may come in handy anyway (especially curl) when implementing a GitHub Action.
Blog Post on DEV: pyaction: A Docker container with Python, git, and the GitHub CLI, posted on December 28, 2022. See a list of additional blog posts later in this README.
Multiplatform Image
pyaction…
Where You Can Find Me
Follow me here on DEV and on GitHub:
Top comments (2)
Interesting information, thank you!
Some comments may only be visible to logged-in visitors. Sign in to view all comments.