Skip to content

Commit

Permalink
[fixpython][feat] Update to Python 3.12 / Debian Bookworm
Browse files Browse the repository at this point in the history
  • Loading branch information
lloesche committed Mar 7, 2024
1 parent f47905b commit a2b9351
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# This is the Fix Inventory Python container. It includes CPython and is used
# as the common base for all the other containers.
FROM ubuntu:20.04 as build-env
FROM python:3.12.2-bookworm as build-env
ENV DEBIAN_FRONTEND=noninteractive
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG PYTHON_VERSION=3.11.3

ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN echo "I am running on ${BUILDPLATFORM}, building for ${TARGETPLATFORM}"
Expand Down Expand Up @@ -42,25 +41,16 @@ RUN apt-get -y install \
cargo \
linux-headers-generic

# Download and install CPython
WORKDIR /build/python
RUN curl -L -o /tmp/python.tar.gz https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
RUN tar xzvf /tmp/python.tar.gz --strip-components=1 -C /build/python
RUN ./configure --enable-optimizations --prefix /usr/local/python
RUN make -j 12
RUN make install
RUN /usr/local/python/bin/python3 -m ensurepip

# Create CPython venv
WORKDIR /usr/local
RUN /usr/local/python/bin/python3 -m venv fix-venv-python3
RUN python3 -m venv fix-venv-python3

# Download and install Python test tools
RUN . /usr/local/fix-venv-python3/bin/activate && python -m pip install -U pip wheel tox flake8


# Setup main image
FROM ubuntu:20.04
FROM python:3.12.2-bookworm
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG="en_US.UTF-8"
COPY --from=build-env /usr/local /usr/local
Expand Down Expand Up @@ -99,7 +89,7 @@ RUN apt-get update \
linux-headers-generic \
dumb-init \
iproute2 \
libffi7 \
libffi8 \
openssl \
procps \
dateutils \
Expand Down

0 comments on commit a2b9351

Please sign in to comment.