Skip to content

Commit b1e827a

Browse files
committed
chore: initial commit
0 parents  commit b1e827a

File tree

8 files changed

+528
-0
lines changed

8 files changed

+528
-0
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
labels: ["dependencies"]
9+
commit-message:
10+
prefix: "ci"
11+
include: "scope"

.github/workflows/publish.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
branches:
6+
- 'coatl'
7+
paths:
8+
- '.github/workflows/publish-2.7.yml'
9+
- '2.7/**'
10+
schedule:
11+
- cron: '0 8 14,28 * *'
12+
13+
jobs:
14+
docker:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
image:
19+
- version: '2.7'
20+
variant: bookworm
21+
tags: |
22+
2
23+
2.7
24+
2.7-bookworm
25+
2.7.18
26+
2.7.18-bookworm
27+
- version: '2.7'
28+
variant: slim-bookworm
29+
tags: |
30+
2-slim
31+
2.7-slim
32+
2.7-slim-bookworm
33+
2.7.18-slim
34+
2.7.18-slim-bookworm
35+
steps:
36+
- name: Set up QEMU
37+
uses: docker/setup-qemu-action@v3
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v3
41+
42+
- name: Login to Docker Hub
43+
uses: docker/login-action@v3
44+
with:
45+
username: ${{ vars.DOCKERHUB_USERNAME }}
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Docker meta
49+
id: meta
50+
uses: docker/metadata-action@v5
51+
with:
52+
images: coatldev/python
53+
tags: |
54+
${{ matrix.image.tags }}
55+
56+
- name: Build and push
57+
uses: docker/build-push-action@v6
58+
with:
59+
file: ${{ matrix.image.version }}/${{ matrix.image.variant }}/Dockerfile
60+
platforms: linux/amd64,linux/arm64
61+
push: true
62+
tags: ${{ steps.meta.outputs.tags }}

.hadolint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignored:
2+
- DL3008 # apt-get install pinned versions

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ci:
2+
autoupdate_commit_msg: 'build(deps): pre-commit autoupdate'
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.6.0
7+
hooks:
8+
- id: check-yaml
9+
- id: trailing-whitespace
10+
- repo: https://github.com/python-jsonschema/check-jsonschema
11+
rev: 0.29.2
12+
hooks:
13+
- id: check-github-workflows
14+
- repo: https://github.com/coatl-dev/hadolint-coatl
15+
rev: 2.12.1b0
16+
hooks:
17+
- id: hadolint

2.7/bookworm/Dockerfile

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
FROM buildpack-deps:bookworm
2+
3+
LABEL \
4+
maintainer="César Román <cesar@coatl.dev>" \
5+
repository="https://github.com/coatl-dev/docker-python" \
6+
vendor="coatl.dev"
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
ENV PIP_NO_CACHE_DIR=1
11+
ENV PIP_NO_PYTHON_VERSION_WARNING=1
12+
ENV PIP_ROOT_USER_ACTION=ignore
13+
14+
# ensure local python is preferred over distribution python
15+
ENV PATH=/usr/local/bin:$PATH
16+
17+
# cannot remove LANG even though https://bugs.python.org/issue19846 is fixed
18+
# last attempted removal of LANG broke many users:
19+
# https://github.com/docker-library/python/pull/570
20+
ENV LANG=C.UTF-8
21+
# https://github.com/docker-library/python/issues/147
22+
ENV PYTHONIOENCODING=UTF-8
23+
24+
# runtime dependencies
25+
RUN set -eux; \
26+
\
27+
apt-get update --quiet; \
28+
apt-get upgrade --yes; \
29+
apt-get install --yes --no-install-recommends \
30+
tk-dev \
31+
; \
32+
rm -rf /var/lib/apt/lists/*
33+
34+
ENV PYTHON_VERSION=2.7.18
35+
ENV PYTHON_TAR_SHA256=b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43
36+
37+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
38+
# hadolint ignore=DL3003
39+
RUN set -eux; \
40+
\
41+
wget -q -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \
42+
echo "$PYTHON_TAR_SHA256 *python.tar.xz" | sha256sum --check --strict -; \
43+
mkdir -p /usr/src/python; \
44+
tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \
45+
rm python.tar.xz; \
46+
\
47+
cd /usr/src/python; \
48+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
49+
./configure \
50+
--build="$gnuArch" \
51+
--enable-optimizations \
52+
--enable-option-checking=fatal \
53+
--enable-shared \
54+
--enable-unicode=ucs4 \
55+
; \
56+
make -s -j "$(nproc)" \
57+
# setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916
58+
PROFILE_TASK='-m test.regrtest --pgo \
59+
test_array \
60+
test_base64 \
61+
test_binascii \
62+
test_binhex \
63+
test_binop \
64+
test_bytes \
65+
test_c_locale_coercion \
66+
test_class \
67+
test_cmath \
68+
test_codecs \
69+
test_compile \
70+
test_complex \
71+
test_csv \
72+
test_decimal \
73+
test_dict \
74+
test_float \
75+
test_fstring \
76+
test_hashlib \
77+
test_io \
78+
test_iter \
79+
test_json \
80+
test_long \
81+
test_math \
82+
test_memoryview \
83+
test_pickle \
84+
test_re \
85+
test_set \
86+
test_slice \
87+
test_struct \
88+
test_threading \
89+
test_time \
90+
test_traceback \
91+
test_unicode \
92+
' \
93+
; \
94+
make install; \
95+
ldconfig; \
96+
\
97+
cd /; \
98+
rm -rf /usr/src/python; \
99+
\
100+
find /usr/local -depth \
101+
\( \
102+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
103+
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \
104+
\) -exec rm -rf '{}' + \
105+
; \
106+
\
107+
python2 --version
108+
109+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
110+
ENV PYTHON_PIP_VERSION=20.3.4
111+
ENV PYTHON_SETUPTOOLS_VERSION=44.1.1
112+
ENV PYTHON_WHEEL_VERSION=0.37.1
113+
# https://github.com/pypa/get-pip
114+
ENV PYTHON_GET_PIP_URL=https://raw.githubusercontent.com/pypa/get-pip/HEAD/public/2.7/get-pip.py
115+
ENV PYTHON_GET_PIP_SHA256=40ee07eac6674b8d60fce2bbabc148cf0e2f1408c167683f110fd608b8d6f416
116+
117+
118+
RUN set -ex; \
119+
\
120+
wget -q -O get-pip.py "$PYTHON_GET_PIP_URL"; \
121+
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \
122+
\
123+
python get-pip.py \
124+
--disable-pip-version-check \
125+
--no-cache-dir \
126+
"pip==$PYTHON_PIP_VERSION" \
127+
; \
128+
pip --version; \
129+
\
130+
find /usr/local -depth \
131+
\( \
132+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
133+
-o \
134+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
135+
\) -exec rm -rf '{}' +; \
136+
rm -f get-pip.py
137+
138+
# install "virtualenv", since the vast majority of users of this image will want it
139+
RUN python -m pip install virtualenv==20.15.1
140+
141+
CMD ["python2"]

0 commit comments

Comments
 (0)