Sign inSign up

justdevzero/py37-tools

By justdevzero

Updated 8 days ago

Python 3.7 on Ubuntu 18.04 (bionic) with build tools and UTF-8 locales. No X11, no GUI stack.

Image
0

53

justdevzero/py37-tools repository overview

# Python 3.7 on Ubuntu 18.04 (bionic).
#
# Bionic is the last Ubuntu LTS where Python 2.7 and Python 3.7 both come from
# apt, which makes it the usual target for codebases still finishing a 2-to-3
# migration. This image exists so that wheels are built, downloaded and tested
# against the same distribution, interpreter and C library the deployment runs
# on: bionic ships glibc 2.27, so a manylinux_2_28 wheel resolved on a modern
# machine is silently rejected here, and the failure surfaces much later as an
# unrelated dependency conflict.
#
# Included: python3.7 with headers, a virtualenv on PATH, a toolchain for
# building C extensions, and the common UTF-8 locales.
# Deliberately absent: X11, cairo, Qt and any other GUI stack.

FROM ubuntu:18.04

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

# python3.7 + headers: build and install C extensions
# build-essential, binutils: the toolchain those extensions need
# ca-certificates: TLS for pip
# locales: generated below
RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        python3.7 \
        python3.7-dev \
        python3.7-venv \
        python3-distutils \
        build-essential \
        binutils \
        ca-certificates \
        locales; \
    update-ca-certificates; \
    apt-get clean; \
    rm -rf /var/lib/apt/lists/*

# UTF-8 locales for the languages an application is likely to format dates,
# numbers and currencies in. Add more with `locale-gen` at runtime if needed.
RUN set -eux; \
    for loc in \
        ca_ES cs_CZ de_DE en_GB en_US es_ES fr_FR hr_HR hu_HU it_IT \
        lt_LT nl_NL pl_PL pt_PT ru_RU sk_SK zh_CN; do \
        sed -i "s/^# ${loc}.UTF-8/${loc}.UTF-8/" /etc/locale.gen; \
    done; \
    locale-gen; \
    update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8

# A docker exec is not a login shell and does not read /etc/default/locale, so
# the values are set here as well.
ENV LANG=en_US.UTF-8 \
    LANGUAGE= \
    LC_ALL=en_US.UTF-8

# A virtualenv rather than the system interpreter: pip upgrades here cannot
# break apt-managed packages, and `python` resolves to 3.7 without a suffix.
RUN set -eux; \
    python3.7 -m venv /venv; \
    /venv/bin/pip install --no-cache-dir --upgrade pip setuptools wheel
ENV PATH=/venv/bin:$PATH

WORKDIR /work
CMD ["python"]

Tag summary

Content type

Image

Digest

sha256:8810b2625

Size

179.4 MB

Last updated

8 days ago

docker pull justdevzero/py37-tools