Skip to content

Commit 8fe2dee

Browse files
committed
Add Python 3.6 builder
1 parent 55df76e commit 8fe2dee

File tree

7 files changed

+152
-6
lines changed

7 files changed

+152
-6
lines changed

3.5/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ all: build
77

88
build:
99
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) .
10-
docker tag $(IMAGE_NAME):$(IMAGE_TAG) $(IMAGE_NAME):latest
1110

1211
clean:
1312
docker images $(IMAGE_NAME) | grep -q $(IMAGE_TAG) && docker rmi $(IMAGE_NAME):$(IMAGE_TAG) || true
14-
docker images $(IMAGE_NAME) | grep -q latest && docker rmi $(IMAGE_NAME):latest || true

3.6/Dockerfile

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
FROM tatsushid/tinycore:7.2-x86_64
2+
3+
# Instructions are run with 'tc' user
4+
5+
# http://bugs.python.org/issue19846
6+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
7+
ENV LANG=C.UTF-8 LC_ALL=C
8+
9+
RUN tce-load -wic gnupg curl \
10+
&& rm -rf /tmp/tce/optional/*
11+
12+
# gpg: key AA65421D: public key "Ned Deily (Python release signing key) <nad@python.org>" imported
13+
RUN gpg2 --keyserver pool.sks-keyservers.net --recv-keys 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
14+
15+
ENV PYTHON_VERSION 3.6.0
16+
17+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
18+
ENV PYTHON_PIP_VERSION 9.0.1
19+
20+
RUN tce-load -wic \
21+
bzip2-dev \
22+
flex \
23+
file \
24+
gcc \
25+
make \
26+
linux-4.2.1_api_headers \
27+
glibc_add_lib \
28+
glibc_base-dev \
29+
openssl-dev \
30+
gdbm-dev \
31+
ncurses-dev \
32+
readline-dev \
33+
sqlite3-dev \
34+
liblzma-dev \
35+
zlib_base-dev \
36+
tk-dev \
37+
libX11-dev \
38+
libXss \
39+
xorg-proto \
40+
&& cd /tmp \
41+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
42+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
43+
&& gpg2 --verify python.tar.xz.asc \
44+
&& rm python.tar.xz.asc \
45+
&& tar -xJf python.tar.xz \
46+
&& rm python.tar.xz \
47+
&& cd "/tmp/Python-$PYTHON_VERSION" \
48+
&& ./configure --enable-shared \
49+
&& make \
50+
&& mkdir tmp_install \
51+
&& make install DESTDIR=tmp_install \
52+
&& for F in `find tmp_install | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d :`; do \
53+
[ -f $F ] && strip --strip-unneeded $F; \
54+
done \
55+
&& for F in `find tmp_install | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d :`; do \
56+
[ -f $F ] && if [ ! -w $F ]; then chmod u+w $F && strip -g $F && chmod u-w $F; else strip -g $F; fi \
57+
done \
58+
&& for F in `find tmp_install | xargs file | grep "current ar archive" | cut -f 1 -d :`; do \
59+
[ -f $F ] && strip -g $F; \
60+
done \
61+
&& find tmp_install \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' + \
62+
&& find tmp_install \( -type d -a -name test -o -name tests \) | xargs rm -rf \
63+
&& $(cd tmp_install; sudo cp -R . /) \
64+
&& rm -rf "/tmp/Python-$PYTHON_VERSION" \
65+
&& cd /tmp/tce/optional \
66+
&& for PKG in `ls *-dev.tcz`; do \
67+
echo "Removing $PKG files"; \
68+
for F in `unsquashfs -l $PKG | grep squashfs-root | sed -e 's/squashfs-root//'`; do \
69+
[ -f $F -o -L $F ] && sudo rm -f $F; \
70+
done; \
71+
INSTALLED=$(echo -n $PKG | sed -e s/.tcz//); \
72+
sudo rm -f /usr/local/tce.installed/$INSTALLED; \
73+
done \
74+
&& for PKG in binutils.tcz \
75+
cloog.tcz \
76+
flex.tcz \
77+
file.tcz \
78+
gcc.tcz \
79+
gcc_libs.tcz \
80+
linux-4.2.1_api_headers.tcz \
81+
make.tcz \
82+
sqlite3-bin.tcz \
83+
xz.tcz \
84+
xorg-proto.tcz; do \
85+
echo "Removing $PKG files"; \
86+
for F in `unsquashfs -l $PKG | grep squashfs-root | sed -e 's/squashfs-root//'`; do \
87+
[ -f $F -o -L $F ] && sudo rm -f $F; \
88+
done; \
89+
INSTALLED=$(echo -n $PKG | sed -e s/.tcz//); \
90+
sudo rm -f /usr/local/tce.installed/$INSTALLED; \
91+
done \
92+
&& sudo rm -f /usr/bin/file \
93+
&& sudo /sbin/ldconfig \
94+
&& rm -rf /tmp/tce/optional/* \
95+
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | sudo python3 \
96+
&& sudo pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \
97+
&& sudo find /usr/local \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' + \
98+
&& find /usr/local \( -type d -a -name test -o -name tests \) | sudo xargs rm -rf \
99+
&& sudo rm -rf /usr/src/python
100+
101+
# Instructions after here are run with 'root' user
102+
USER root
103+
104+
RUN cd /usr/local/bin \
105+
&& ln -s easy_install-3.6 easy_install \
106+
&& ln -s idel3 idle \
107+
&& ln -s pydoc3 pydoc \
108+
&& ln -s python3 python \
109+
&& ln -s python3-config python-config
110+
111+
CMD ["python3"]

3.6/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
IMAGE_NAME := tinycore-python
2+
IMAGE_TAG := 3.6
3+
4+
.PHONY: all clean build
5+
6+
all: build
7+
8+
build:
9+
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) .
10+
docker tag $(IMAGE_NAME):$(IMAGE_TAG) $(IMAGE_NAME):latest
11+
12+
clean:
13+
docker images $(IMAGE_NAME) | grep -q $(IMAGE_TAG) && docker rmi $(IMAGE_NAME):$(IMAGE_TAG) || true
14+
docker images $(IMAGE_NAME) | grep -q latest && docker rmi $(IMAGE_NAME):latest || true

3.6/onbuild/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM tatsushid/tinycore-python:3.6
2+
3+
RUN mkdir -p /usr/src/app
4+
WORKDIR /usr/src/app
5+
6+
ONBUILD COPY requirements.txt /usr/src/app/
7+
ONBUILD RUN pip install --no-cache-dir -r requirements.txt
8+
9+
ONBUILD COPY . /usr/src/app

3.6/onbuild/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
IMAGE_NAME := tinycore-python
2+
IMAGE_TAG := 3.6-onbuild
3+
4+
.PHONY: all clean build
5+
6+
all: build
7+
8+
build:
9+
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) .
10+
11+
clean:
12+
docker images $(IMAGE_NAME) | grep -q $(IMAGE_TAG) && docker rmi $(IMAGE_NAME):$(IMAGE_TAG) || true

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
PYTHON_DIRS := 3.5 3.4 2.7
2-
ONBUILD_DIRS := 3.5/onbuild 3.4/onbuild 2.7/onbuild
1+
PYTHON_DIRS := 3.6 3.5 3.4 2.7
2+
ONBUILD_DIRS := 3.6/onbuild 3.5/onbuild 3.4/onbuild 2.7/onbuild
33

44
.PHONY: all clean $(PYTHON_DIRS) $(ONBUILD_DIRS)
55

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ This provides a small but a fully functional [Python](https://www.python.org/) r
99
- [`2.7-onbuild` (2.7/onbuild/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/2.7/onbuild/Dockerfile)
1010
- [`3.4` (3.4/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/3.4/Dockerfile)
1111
- [`3.4-onbuild` (3.4/onbuild/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/3.4/onbuild/Dockerfile)
12-
- [`3.5`, `latest` (3.5/Dockerfile)][Latest Dockerfile]
12+
- [`3.5` (3.5/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/3.5/Dockerfile)
1313
- [`3.5-onbuild` (3.5/onbuild/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/3.5/onbuild/Dockerfile)
14+
- [`3.6`, `latest` (3.6/Dockerfile)][Latest Dockerfile]
15+
- [`3.6-onbuild` (3.6/onbuild/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/3.6/onbuild/Dockerfile)
1416

1517
## How to use this image
1618

@@ -20,4 +22,4 @@ This can be used in the same way as [Official Python Image](https://hub.docker.c
2022

2123
This doesn't contain a compiler, a linker and headers etc. so if you'd like to add a something C extension for Python, first you need to install them by `tce-load` command. Please refer this image's [Dockerfile][Latest Dockerfile] which is a good example of installing those packages.
2224

23-
[Latest Dockerfile]: https://github.com/tatsushid/docker-tinycore-python/blob/master/3.5/Dockerfile
25+
[Latest Dockerfile]: https://github.com/tatsushid/docker-tinycore-python/blob/master/3.6/Dockerfile

0 commit comments

Comments
 (0)