Skip to content

Commit 42fc724

Browse files
committed
Added Python 3.12
1 parent 89db7fa commit 42fc724

12 files changed

Lines changed: 813 additions & 66 deletions

File tree

README.md

Lines changed: 54 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ packages such as NumPy, Pandas and Dash/Plotly, on top of the native images
4545
maintained by the
4646
[Docker Python project](https://github.com/docker-library/python):
4747
* [Python 3.12-rc](https://github.com/docker-library/python/tree/master/3.12-rc/)
48-
+ [Python 3.12-rc - Debian Bookworm](https://github.com/docker-library/python/tree/master/3.12-rc/bookworm)
49-
+ [Python 3.12-rc - Debian Bullseye](https://github.com/docker-library/python/tree/master/3.12-rc/bullseye)
50-
+ [Python 3.12-rc - Alpine 3.18](https://github.com/docker-library/python/tree/master/3.12-rc/alpine3.18)
48+
+ [Python 3.12 - Debian Bookworm](https://github.com/docker-library/python/tree/master/3.12/bookworm)
49+
+ [Python 3.12 - Debian Bullseye](https://github.com/docker-library/python/tree/master/3.12/bullseye)
50+
+ [Python 3.12 - Alpine 3.18](https://github.com/docker-library/python/tree/master/3.12/alpine3.18)
5151
* [Python 3.11](https://github.com/docker-library/python/tree/master/3.11/)
5252
+ [Python 3.11 - Debian Bookworm](https://github.com/docker-library/python/tree/master/3.11/bookworm)
5353
+ [Python 3.11 - Debian Bullseye](https://github.com/docker-library/python/tree/master/3.11/bullseye)
@@ -98,10 +98,10 @@ of Dash applications.
9898
https://github.com/machine-learning-helpers/docker-python-light
9999

100100
* [Native Python OCI images](https://github.com/docker-library/python):
101-
+ [Python 3.12-rc](https://github.com/docker-library/python/tree/master/3.12-rc)
102-
- https://github.com/docker-library/python/tree/master/3.12-rc/bookworm
103-
- https://github.com/docker-library/python/tree/master/3.12-rc/bullseye
104-
- https://github.com/docker-library/python/tree/master/3.12-rc/alpine3.18
101+
+ [Python 3.12](https://github.com/docker-library/python/tree/master/3.12)
102+
- https://github.com/docker-library/python/tree/master/3.12/bookworm
103+
- https://github.com/docker-library/python/tree/master/3.12/bullseye
104+
- https://github.com/docker-library/python/tree/master/3.12/alpine3.18
105105
+ [Python 3.11](https://github.com/docker-library/python/tree/master/3.11)
106106
- https://github.com/docker-library/python/tree/master/3.11/bookworm
107107
- https://github.com/docker-library/python/tree/master/3.11/bullseye
@@ -158,6 +158,19 @@ $ cd docker-python-light
158158
```
159159

160160
* Build the OCI images (here with Docker, but any other tool may be used):
161+
+ Python 3.12
162+
- `py312-bookworm` tag: Debian Bookworm / Python 3.12:
163+
```bash
164+
$ docker build -t infrahelpers/python-light:py312-bookworm python-3.12-bookworm
165+
```
166+
- `py312-bullseye` tag: Debian Bullseye / Python 3.12:
167+
```bash
168+
$ docker build -t infrahelpers/python-light:py312-bullseye python-3.12-bullseye
169+
```
170+
- `py312-alp318` tag: Alpine 3.18 / Python 3.12:
171+
```bash
172+
$ docker build -t infrahelpers/python-light:py312-alp318 python-3.12-alpine-3.18
173+
```
161174
+ Python 3.11
162175
- `py311-bookworm` tag: Debian Bookworm / Python 3.11:
163176
```bash
@@ -167,45 +180,36 @@ $ docker build -t infrahelpers/python-light:py311-bookworm python-3.11-bookworm
167180
```bash
168181
$ docker build -t infrahelpers/python-light:py311-bullseye python-3.11-bullseye
169182
```
170-
- `py311-alp317` tag: Alpine 3.17 / Python 3.11:
183+
- `py311-alp318` tag: Alpine 3.18 / Python 3.11:
171184
```bash
172-
$ docker build -t infrahelpers/python-light:py311-alp317 python-3.11-alpine-3.17
185+
$ docker build -t infrahelpers/python-light:py311-alp318 python-3.11-alpine-3.18
173186
```
174187
+ Python 3.10
175-
- `py310-bullseye` tag: Debian Bullseye / Python 3.10:
176-
```bash
177-
$ docker build -t infrahelpers/python-light:py310-bullseye python-3.10-bullseye
178-
$ docker tag infrahelpers/python-light:py310-bullseye infrahelpers/python-light:latest
179-
```
180-
- `py310-buster` tag: Debian Buster / Python 3.10:
188+
- `py310-bookworm` tag: Debian Bookworm / Python 3.10:
181189
```bash
182-
$ docker build -t infrahelpers/python-light:py310-buster python-3.10-buster
190+
$ docker build -t infrahelpers/python-light:py310-bookworm python-3.10-bookworm
183191
```
184-
- `alp317-py31011` tag: Alpine 3.17 / Python 3.10.11:
192+
- `py310-bullseye` tag: Debian Bullseye / Python 3.10:
185193
```bash
186-
$ docker build -t infrahelpers/python-light:alp317-py31011 alpine-3.17
194+
$ docker build -t infrahelpers/python-light:py310-bullseye python-3.10-bullseye
187195
```
188-
- `alp316-py31011` tag: Alpine 3.16 / Python 3.10.11:
196+
+ Python 3.9
197+
- `py39-bookworm` tag: Debian Bookworm / Python 3.9:
189198
```bash
190-
$ docker build -t infrahelpers/python-light:alp316-py31011 alpine-3.16
199+
$ docker build -t infrahelpers/python-light:py39-bookworm python-3.9-bookworm
191200
```
192-
+ Python 3.9
193201
- `py39-bullseye` tag: Debian Bullseye / Python 3.9:
194202
```bash
195203
$ docker build -t infrahelpers/python-light:py39-bullseye python-3.9-bullseye
196204
```
197-
- `py39-buster` tag: Debian Buster / Python 3.9:
205+
+ Python 3.8
206+
- `py38-bookworm` tags: Debian Bookworm / Python 3.8:
198207
```bash
199-
$ docker build -t infrahelpers/python-light:py39-buster python-3.9-buster
208+
$ docker build -t infrahelpers/python-light:py38-bookworm python-3.8-bookworm
200209
```
201-
+ Python 3.8
202210
- `latest`/`py38-bullseye` tags: Debian Bullseye / Python 3.8:
203211
```bash
204212
$ docker build -t infrahelpers/python-light:py38-bullseye python-3.8-bullseye
205-
```
206-
- `py38-buster` tags: Debian Buster / Python 3.8:
207-
```bash
208-
$ docker build -t infrahelpers/python-light:py38-buster python-3.8-buster
209213
```
210214

211215
* (Optional) Push the newly built images to Docker Hub.
@@ -214,18 +218,20 @@ $ docker build -t infrahelpers/python-light:py38-buster python-3.8-buster
214218
[a change on GitHub](https://github.com/machine-learning-helpers/docker-python-light/commits/master))
215219
```bash
216220
$ docker login
221+
$ docker push infrahelpers/python-light:py312-bookworm
222+
$ docker push infrahelpers/python-light:py312-bullseye
223+
$ docker push infrahelpers/python-light:py312-alp318
224+
$ docker push infrahelpers/python-light:py311-bookworm
217225
$ docker push infrahelpers/python-light:py311-bullseye
218-
$ docker push infrahelpers/python-light:py311-buster
219-
$ docker push infrahelpers/python-light:py311-alp317
226+
$ docker push infrahelpers/python-light:py311-alp318
227+
$ docker push infrahelpers/python-light:py310-bookworm
220228
$ docker push infrahelpers/python-light:py310-bullseye
221-
$ docker push infrahelpers/python-light:latest
222-
$ docker push infrahelpers/python-light:py310-buster
229+
$ docker push infrahelpers/python-light:py39-bookworm
223230
$ docker push infrahelpers/python-light:py39-bullseye
224-
$ docker push infrahelpers/python-light:py39-buster
231+
$ docker push infrahelpers/python-light:py38-bookworm
225232
$ docker push infrahelpers/python-light:py38-bullseye
226-
$ docker push infrahelpers/python-light:py38-buster
227-
$ docker push infrahelpers/python-light:alp317-py31011
228-
$ docker push infrahelpers/python-light:alp316-py31011
233+
$ docker push infrahelpers/python-light:alp318-py311
234+
$ docker push infrahelpers/python-light:alp317-py310
229235
```
230236

231237
* (Optional) Push the newly built images to Quay.io.
@@ -238,53 +244,35 @@ $ docker login quay.io
238244
```
239245
+ Python 3.11:
240246
```bash
247+
$ docker tag infrahelpers/python-light:py311-bookworm quay.io/artificialintelligence/python-light:py311-bookworm
248+
$ docker push quay.io/artificialintelligence/python-light:py311-bookworm
249+
#
241250
$ docker tag infrahelpers/python-light:py311-bullseye quay.io/artificialintelligence/python-light:py311-bullseye
242251
$ docker push quay.io/artificialintelligence/python-light:py311-bullseye
243-
#
244-
$ docker tag infrahelpers/python-light:py311-buster quay.io/artificialintelligence/python-light:py311-buster
245-
$ docker push quay.io/artificialintelligence/python-light:py311-buster
246-
#
247-
$ docker tag infrahelpers/python-light:py311-alp317 quay.io/artificialintelligence/python-light:py311-alp317
248-
$ docker push quay.io/artificialintelligence/python-light:py311-alp317
249252
```
250253
+ Python 3.10:
251254
```bash
255+
$ docker tag infrahelpers/python-light:py310-bookworm quay.io/artificialintelligence/python-light:py310-bookworm
256+
$ docker push quay.io/artificialintelligence/python-light:py310-bookworm
257+
#
252258
$ docker tag infrahelpers/python-light:py310-bullseye quay.io/artificialintelligence/python-light:py310-bullseye
253259
$ docker push quay.io/artificialintelligence/python-light:py310-bullseye
254-
#
255-
$ docker tag infrahelpers/python-light:py310-buster quay.io/artificialintelligence/python-light:py310-buster
256-
$ docker push quay.io/artificialintelligence/python-light:py310-buster
257-
#
258-
$ docker tag infrahelpers/python-light:py310-alp317 quay.io/artificialintelligence/python-light:py310-alp317
259-
$ docker push quay.io/artificialintelligence/python-light:py310-alp317
260260
```
261261
+ Python 3.9:
262262
```bash
263+
$ docker tag infrahelpers/python-light:py39-bookworm quay.io/artificialintelligence/python-light:py39-bookworm
264+
$ docker push quay.io/artificialintelligence/python-light:py39-bookworm
265+
#
263266
$ docker tag infrahelpers/python-light:py39-bullseye quay.io/artificialintelligence/python-light:py39-bullseye
264267
$ docker push quay.io/artificialintelligence/python-light:py39-bullseye
265-
#
266-
$ docker tag infrahelpers/python-light:py39-buster quay.io/artificialintelligence/python-light:py39-buster
267-
$ docker push quay.io/artificialintelligence/python-light:py39-buster
268-
#
269-
$ docker tag infrahelpers/python-light:py39-alp317 quay.io/artificialintelligence/python-light:py39-alp317
270-
$ docker push quay.io/artificialintelligence/python-light:py39-alp317
271-
#
272-
$ docker tag infrahelpers/python-light:alp317-py3104 quay.io/artificialintelligence/python-light:alp317-py3104
273-
$ docker push quay.io/artificialintelligence/python-light:alp317-py3104
274-
#
275-
$ docker tag infrahelpers/python-light:alp315-py397 quay.io/artificialintelligence/python-light:alp315-py397
276-
$ docker push quay.io/artificialintelligence/python-light:alp315-py397
277268
```
278269
+ Python 3.8:
279270
```bash
271+
$ docker tag infrahelpers/python-light:py38-bookworm quay.io/artificialintelligence/python-light:py38-bookworm
272+
$ docker push quay.io/artificialintelligence/python-light:py38-bookworm
273+
#
280274
$ docker tag infrahelpers/python-light:py38-bullseye quay.io/artificialintelligence/python-light:py38-bullseye
281275
$ docker push quay.io/artificialintelligence/python-light:py38-bullseye
282-
#
283-
$ docker tag infrahelpers/python-light:py38-buster quay.io/artificialintelligence/python-light:py38-buster
284-
$ docker push quay.io/artificialintelligence/python-light:py38-buster
285-
#
286-
$ docker tag infrahelpers/python-light:py38-alp317 quay.io/artificialintelligence/python-light:py38-alp317
287-
$ docker push quay.io/artificialintelligence/python-light:py38-alp317
288276
```
289277

290278
* Shutdown the Docker image

python-3.12-alpine-3.18/Dockerfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#
2+
# Source: https://github.com/machine-learning-helpers/docker-python-light/tree/master/python-3.12-alpine-3.18/Dockerfile
3+
# On Docker Hub: https://hub.docker.com/repository/docker/artificialintelligence/python-light/general
4+
# Usual Docker tag: py312-alp318 (infrahelpers/python-light:py312-alp318)
5+
#
6+
# See also:
7+
# * Python 3.12 Alpine 3.18:
8+
# + Image on Docker Hub/Cloud: https://hub.docker.com/_/python?tab=tags&page=1&name=3.12-alpine3.18
9+
# + Dockerfile: https://github.com/docker-library/python/blob/master/3.12/alpine3.18/Dockerfile
10+
# * The best Docker base image for your Python application, Jun. 2023:
11+
# https://pythonspeed.com/articles/base-image-python-docker-images/
12+
# * Alpine 3.18 (featuring Python 3.11.6)
13+
# + Image on Docker Hub/Cloud: https://hub.docker.com/_/alpine
14+
# + Dockerfile: https://github.com/alpinelinux/docker-alpine/blob/v3.18/x86_64/Dockerfile
15+
#
16+
FROM python:3.12-alpine3.18
17+
18+
LABEL authors="Denis Arnaud <denis.arnaud_github at m4x dot org>"
19+
20+
# Tell Docker about the server port
21+
EXPOSE 5000
22+
23+
#
24+
ENV HOME /root
25+
26+
# Install the Python dependencies
27+
WORKDIR $HOME
28+
RUN apk update && \
29+
apk add net-tools tzdata sudo curl wget less htop \
30+
bzip2-dev xz-dev zlib-dev util-linux-dev coreutils \
31+
dpkg-dev dpkg expat-dev findutils \
32+
libstdc++ gdbm-dev libc-dev \
33+
autoconf automake libtool \
34+
man-pages bash bash-doc bash-completion git vim \
35+
musl linux-headers build-base ca-certificates \
36+
gcc libgcc g++ gfortran cython file libffi-dev libressl-dev \
37+
musl-dev lapack-dev openblas-dev freetype-dev \
38+
openssl-dev libnsl-dev libressl-dev \
39+
ncurses-dev readline-dev tk-dev tcl-dev lcms2-dev \
40+
jpeg-dev openjpeg-dev tiff-dev \
41+
sqlite-dev postgresql-dev libxml2-dev libxslt-dev make jq \
42+
python3-dev py3-pip py3-setuptools py3-wheel py3-pytest py3-tox \
43+
py3-psutil py3-scipy \
44+
rust cargo
45+
46+
RUN python3 -mpip install -U pip
47+
RUN python3 -mpip install -U build
48+
RUN python3 -mpip install -U dill joblib
49+
RUN python3 -mpip install -U twine
50+
RUN python3 -mpip install -U sphinx poetry
51+
RUN python3 -mpip install -U flake8 black mypy
52+
RUN python3 -mpip install -U simplejson
53+
#RUN python3 -mpip install -U pyjq
54+
RUN python3 -mpip install -U pyyaml
55+
RUN python3 -mpip install -U protobuf
56+
RUN python3 -mpip install -U numpy
57+
RUN python3 -mpip install -U pandas
58+
RUN python3 -mpip install -U pandas-datareader
59+
RUN python3 -mpip install -U matplotlib
60+
RUN python3 -mpip install -U seaborn
61+
RUN python3 -mpip install -U scikit-learn
62+
RUN python3 -mpip install -U psycopg2
63+
RUN python3 -mpip install -U opentraveldata OpenTrepWrapper neobase
64+
65+
RUN rm -rf /var/cache/apk/*
66+
#RUN apk del .build-deps
67+
68+
#
69+
#ENTRYPOINT ["/bin/bash"]
70+
CMD ["/bin/bash"]
71+

python-3.12-bookworm/Dockerfile

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#
2+
# Source: https://github.com/machine-learning-helpers/docker-python-light/tree/master/docker/python-3.12-bookworm/Dockerfile
3+
# On Docker Hub: https://hub.docker.com/repository/docker/infrahelpers/python-light/general
4+
# Usual Docker tag: py312-bookworm (infrahelpers/python-light:py312-bookworm)
5+
#
6+
7+
# See also:
8+
# * Python 3.12 Debian Bookworm:
9+
# + Image on Docker Hub/Cloud: https://hub.docker.com/_/python?tab=tags&page=1&name=3.12-bookworm
10+
# + Dockerfile: https://github.com/docker-library/python/blob/master/3.12/bookworm/Dockerfile
11+
# * The best Docker base image for your Python application, Apr. 2020:
12+
# https://pythonspeed.com/articles/base-image-python-docker-images/
13+
# * General purpose Debian 12 (Bookworm) C++/Python development image:
14+
# + Docker Hub: https://cloud.docker.com/u/infrahelpers/repository/docker/infrahelpers/cpppython
15+
# + Dockerfile: https://github.com/cpp-projects-showcase/docker-images/tree/master/debian12
16+
#
17+
FROM python:3.12-bookworm
18+
19+
LABEL authors="Denis Arnaud <denis.arnaud_github at m4x dot org>"
20+
21+
# Tell Docker about the server port
22+
EXPOSE 5000
23+
24+
# Environment
25+
ENV container docker
26+
ENV HOME /root
27+
ENV LANGUAGE en_US:en
28+
ENV LANG en_US.UTF-8
29+
ENV LANG4GEN en_US.utf8
30+
ENV LC_ALL $LANG
31+
32+
# Update the system
33+
#RUN echo "Europe/Paris" > /etc/timezone
34+
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90-yes
35+
RUN apt-get -qq update
36+
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends \
37+
apt-utils apt-transport-https \
38+
ca-certificates locales locales-all tzdata sudo \
39+
zip unzip gzip bzip2 xz-utils tar p7zip-full \
40+
curl wget netcat net-tools aptitude
41+
42+
# Generate the locales
43+
RUN locale-gen $LANG && \
44+
update-locale LANG=$LANG LANGUAGE=$LANGUAGE LC_ALL=$LC_ALL
45+
46+
# Configure the time-zone
47+
RUN dpkg-reconfigure -f noninteractive tzdata
48+
49+
# Basic, C++ and Python packages
50+
RUN apt-get -qq update && \
51+
apt-get -y install procps less htop screen \
52+
git keychain gawk \
53+
bash-completion vim-nox emacs-nox apt-utils keyutils ftp \
54+
zlib1g-dev libbz2-dev \
55+
lsb-release libgmp-dev \
56+
gcc g++ cppcheck clang cmake manpages patch pkg-config \
57+
m4 autoconf automake libtool libltdl-dev build-essential \
58+
flex bison \
59+
libboost-all-dev libxapian-dev \
60+
libreadline-dev libncurses5-dev \
61+
libzmq5-dev libczmq-dev libssl-dev libffi-dev \
62+
swig graphviz libopenblas-dev
63+
RUN apt-get -y install libmpich-dev libopenmpi-dev \
64+
sqlite3 libsqlite3-dev \
65+
mariadb-client default-libmysqlclient-dev \
66+
postgresql-client \
67+
libpqxx-dev \
68+
libicu-dev libprotobuf-dev protobuf-compiler \
69+
python3 libpython3-dev \
70+
python3-django libapache2-mod-wsgi-py3 \
71+
libgeos++-dev \
72+
doxygen ghostscript texlive-latex-recommended \
73+
r-base r-base-dev \
74+
rake \
75+
jq
76+
77+
# Cleaning
78+
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
79+
80+
# yq, the YAML CLI utility like jq, for YAML (https://github.com/mikefarah/yq)
81+
RUN YQ_VER=$(curl -Ls https://api.github.com/repos/mikefarah/yq/releases/latest | grep 'tag_name' | cut -d'v' -f2 | cut -d'"' -f1) && \
82+
curl -Ls \
83+
https://github.com/mikefarah/yq/releases/download/v${YQ_VER}/yq_linux_amd64 \
84+
-o /usr/local/bin/yq && \
85+
chmod 775 /usr/local/bin/yq
86+
87+
# SOCI (https://github.com/SOCI/soci)
88+
RUN mkdir -p /opt/soci
89+
ADD resources/soci-debian-cmake.patch /opt/soci/soci-debian-cmake.patch
90+
RUN SOCI_VER=$(curl -Ls https://api.github.com/repos/SOCI/soci/tags|jq -r '.[].name'|grep "^v"|sort -r|head -1|cut -d'v' -f2,2) && \
91+
curl -Ls \
92+
https://github.com/SOCI/soci/archive/refs/tags/v${SOCI_VER}.tar.gz \
93+
-o /opt/soci/soci-${SOCI_VER}.tar.gz && cd /opt/soci && \
94+
tar zxf soci-${SOCI_VER}.tar.gz && rm -f soci-${SOCI_VER}.tar.gz && \
95+
cd soci-${SOCI_VER} && patch -p1 < ../soci-debian-cmake.patch && \
96+
mkdir -p build && cd build && \
97+
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \
98+
-DSOCI_CXX11=ON -DSOCI_TESTS=OFF .. && \
99+
make install
100+
101+
# Set up the packaging environment for the `build` user
102+
ADD resources/bashrc $HOME/.bashrc
103+
ADD resources/gitconfig $HOME/.gitconfig
104+
ADD resources/vimrc $HOME/.vimrc
105+
RUN chmod 640 $HOME/.bashrc $HOME/.gitconfig $HOME/.vimrc
106+
107+
# Install a few Python modules for data science
108+
WORKDIR $HOME
109+
RUN python3 -mpip install -U pip
110+
RUN python3 -mpip install -U psutil dill joblib
111+
RUN python3 -mpip install -U setuptools wheel build scikit-build
112+
RUN python3 -mpip install -U pytest tox twine
113+
#RUN python3 -mpip install -U pyjq pyyaml
114+
RUN python3 -mpip install -U numpy pandas pandas-datareader
115+
RUN python3 -mpip install -U scikit-learn
116+
RUN python3 -mpip install -U matplotlib seaborn
117+
RUN python3 -mpip install -U dash flask flask_restful connexion requests
118+
RUN python3 -mpip install -U ipython jupyterlab
119+
RUN python3 -mpip install -U opentraveldata OpenTrepWrapper Neobase
120+
RUN python3 -mpip install -U elasticsearch kafka-python
121+
RUN python3 -mpip install -U psycopg2
122+
123+
#
124+
CMD ["/bin/bash"]
125+
126+

0 commit comments

Comments
 (0)