|
| 1 | +# |
| 2 | +# Source: https://github.com/machine-learning-helpers/docker-python-light/tree/master/docker/python-3.11-bullseye/Dockerfile |
| 3 | +# On Docker Hub: https://hub.docker.com/repository/docker/infrahelpers/python-light/general |
| 4 | +# Usual Docker tag: py311-bullseye (infrahelpers/python-light:py311-bullseye) |
| 5 | +# |
| 6 | + |
| 7 | +# See also: |
| 8 | +# * Python 3.11 Debian Bullseye: |
| 9 | +# + Image on Docker Hub/Cloud: https://hub.docker.com/_/python?tab=tags&page=1&name=3.11-bullseye |
| 10 | +# + Dockerfile: https://github.com/docker-library/python/blob/master/3.11/bullseye/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 11 (Bullseye) 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/debian11 |
| 16 | +# |
| 17 | +FROM python:3.11-bullseye |
| 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