From c6934c083244c5b7b9cdae051a2b57473c63d6ac Mon Sep 17 00:00:00 2001 From: Mischa Taylor Date: Sat, 5 Aug 2023 13:49:06 -0400 Subject: [PATCH] Bump python versions to 3.10.12 and 3.11.4 --- python/3.10/jammy/Containerfile | 10 ++++----- python/3.10/jammy/Polly.toml | 2 +- python/3.11/jammy/Containerfile | 10 ++++----- python/3.11/jammy/Polly.toml | 2 +- python/README.md | 37 ++++++++++++++++++++++++++++++++- 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/python/3.10/jammy/Containerfile b/python/3.10/jammy/Containerfile index 4466034..e4d5190 100644 --- a/python/3.10/jammy/Containerfile +++ b/python/3.10/jammy/Containerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 ARG CONTAINER_REGISTRY=docker.io -FROM $CONTAINER_REGISTRY/ubuntu:jammy-20230308 +FROM $CONTAINER_REGISTRY/ubuntu:jammy-20230624 # ensure local python is preferred over distribution python ENV PATH /usr/local/bin:$PATH @@ -37,7 +37,7 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/* ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D -ENV PYTHON_VERSION 3.10.10 +ENV PYTHON_VERSION 3.10.12 SHELL ["/bin/bash", "-o", "pipefail", "-c"] # hadolint ignore=DL3003,SC2015 @@ -115,12 +115,12 @@ RUN set -eux; \ done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 22.3.1 +ENV PYTHON_PIP_VERSION 23.0.1 # https://github.com/docker-library/python/issues/365 ENV PYTHON_SETUPTOOLS_VERSION 65.5.1 # https://github.com/pypa/get-pip -ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/1a96dc5acd0303c4700e02655aefd3bc68c78958/public/get-pip.py -ENV PYTHON_GET_PIP_SHA256 d1d09b0f9e745610657a528689ba3ea44a73bd19c60f4c954271b790c71c2653 +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/9af82b715db434abb94a0a6f3569f43e72157346/public/get-pip.py +ENV PYTHON_GET_PIP_SHA256 45a2bb8bf2bb5eff16fdd00faef6f29731831c7c59bd9fc2bf1f3bed511ff1fe RUN set -eux; \ \ diff --git a/python/3.10/jammy/Polly.toml b/python/3.10/jammy/Polly.toml index ae298e3..f6c5ec4 100644 --- a/python/3.10/jammy/Polly.toml +++ b/python/3.10/jammy/Polly.toml @@ -1,4 +1,4 @@ [container_image] name = 'python' -tags = ["3.10.9-jammy", "3.10-jammy", "3-jammy", "jammy"] +tags = ["3.10.12-jammy", "3.10-jammy", "3-jammy", "jammy"] readme = "python/README.md" diff --git a/python/3.11/jammy/Containerfile b/python/3.11/jammy/Containerfile index 1425781..cf5ea25 100644 --- a/python/3.11/jammy/Containerfile +++ b/python/3.11/jammy/Containerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 ARG CONTAINER_REGISTRY=docker.io -FROM $CONTAINER_REGISTRY/ubuntu:jammy-20230308 +FROM $CONTAINER_REGISTRY/ubuntu:jammy-20230624 # ensure local python is preferred over distribution python ENV PATH /usr/local/bin:$PATH @@ -37,7 +37,7 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/* ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D -ENV PYTHON_VERSION 3.11.2 +ENV PYTHON_VERSION 3.11.4 SHELL ["/bin/bash", "-o", "pipefail", "-c"] # hadolint ignore=DL3003,SC2015 @@ -115,12 +115,12 @@ RUN set -eux; \ done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 22.3.1 +ENV PYTHON_PIP_VERSION 22.3.2 # https://github.com/docker-library/python/issues/365 ENV PYTHON_SETUPTOOLS_VERSION 65.5.1 # https://github.com/pypa/get-pip -ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/1a96dc5acd0303c4700e02655aefd3bc68c78958/public/get-pip.py -ENV PYTHON_GET_PIP_SHA256 d1d09b0f9e745610657a528689ba3ea44a73bd19c60f4c954271b790c71c2653 +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/9af82b715db434abb94a0a6f3569f43e72157346/public/get-pip.py +ENV PYTHON_GET_PIP_SHA256 45a2bb8bf2bb5eff16fdd00faef6f29731831c7c59bd9fc2bf1f3bed511ff1fe RUN set -eux; \ \ diff --git a/python/3.11/jammy/Polly.toml b/python/3.11/jammy/Polly.toml index 05b0f27..39c320f 100644 --- a/python/3.11/jammy/Polly.toml +++ b/python/3.11/jammy/Polly.toml @@ -1,4 +1,4 @@ [container_image] name = 'python' -tags = ["3.11.1-jammy", "3.11-jammy", "3-jammy", "jammy"] +tags = ["3.11.4-jammy", "3.11-jammy", "3-jammy", "jammy"] readme = "python/README.md" diff --git a/python/README.md b/python/README.md index f0e99c9..5771aa3 100644 --- a/python/README.md +++ b/python/README.md @@ -6,4 +6,39 @@ This image packages releases from https://github.com/docker-library/python For best practices on using Python container images, refer to https://pythonspeed.com/docker/ -Source location: https://github.com/boxcutter/oci/tree/main/python +## Using python + +### Running the Python Read-Eval-Print Loop (REPL) + +The Python interpreter is the default command running in this image. Typing an end-of-file character (`Control-D` on Linux, `Control-Z` on Windows) causes the interpreter to exit. You can also exit the interpret by typing in the command: `quit()`. + +``` +docker run -it --rm \ + docker.io/boxcutter/python:3.11-jammy +``` + +### Run a single Python script + +For single file projects, you can run a Python script by using the container image directly: + +``` +docker run -it --rm \ + --mount type=bind,source="$(pwd)",target=/usr/src/myapp \ + --workdir /usr/src/myapp \ + docker.io/boxcutter/python:3.11-jammy python your-script.py +``` + +### Create a Containerfile in your Python app project + +``` +FROM docker.io/polymathrobotics/python:3.11-jammy + +WORKDIR /usr/src/app + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +CMD [ "python", "./your-daemon-or-script.py" ] +``` \ No newline at end of file