Skip to content

Commit 4f125fe

Browse files
committed
Initial import
0 parents  commit 4f125fe

File tree

11 files changed

+301
-0
lines changed

11 files changed

+301
-0
lines changed

2.7/Dockerfile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
FROM tatsushid/tinycore:6.0-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
8+
9+
ENV PYTHON_VERSION 2.7.9
10+
11+
RUN tce-load -wic gnupg curl
12+
&& rm -rf /tmp/tce/optional/*
13+
14+
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
15+
RUN gpg2 --keyserver pool.sks-keyservers.net --recv-keys C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
16+
17+
RUN tce-load -wic \
18+
flex \
19+
file \
20+
gcc \
21+
make \
22+
linux-3.16.2_api_headers \
23+
glibc_base-dev \
24+
openssl-1.0.0-dev \
25+
ncurses-dev \
26+
readline-dev \
27+
zlib_base-dev \
28+
&& cd /tmp \
29+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
30+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
31+
&& gpg2 --verify python.tar.xz.asc \
32+
&& rm python.tar.xz.asc \
33+
&& tar -xJf python.tar.xz \
34+
&& rm python.tar.xz \
35+
&& cd "/tmp/Python-$PYTHON_VERSION" \
36+
&& ./configure --enable-shared --with-ensurepip=install \
37+
&& make \
38+
&& mkdir tmp_install \
39+
&& make install DESTDIR=tmp_install \
40+
&& for F in `find tmp_install | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d :`; do \
41+
[ -f $F ] && strip --strip-unneeded $F; \
42+
done \
43+
&& for F in `find tmp_install | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d :`; do \
44+
[ -f $F ] && if [ ! -w $F ]; then chmod u+w $F && strip -g $F && chmod u-w $F; else strip -g $F; fi \
45+
done \
46+
&& for F in `find tmp_install | xargs file | grep "current ar archive" | cut -f 1 -d :`; do \
47+
[ -f $F ] && strip -g $F; \
48+
done \
49+
&& find tmp_install \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' + \
50+
&& find tmp_install \( -type d -a -name test -o -name tests \) | xargs rm -rf \
51+
&& $(cd tmp_install; sudo cp -R . /) \
52+
&& rm -rf "/tmp/Python-$PYTHON_VERSION" \
53+
&& cd /tmp/tce/optional \
54+
&& for PKG in `ls *-dev.tcz`; do \
55+
echo "Removing $PKG files"; \
56+
for F in `unsquashfs -l $PKG | grep squashfs-root | sed -e 's/squashfs-root//'`; do \
57+
[ -f $F -o -L $F ] && sudo rm -f $F; \
58+
done; \
59+
INSTALLED=$(echo -n $PKG | sed -e s/.tcz//); \
60+
sudo rm -f /usr/local/tce.installed/$INSTALLED; \
61+
done \
62+
&& for PKG in binutils.tcz \
63+
cloog.tcz \
64+
flex.tcz \
65+
gcc.tcz \
66+
gcc_libs.tcz \
67+
linux-3.16.2_api_headers.tcz \
68+
make.tcz; do \
69+
echo "Removing $PKG files"; \
70+
for F in `unsquashfs -l $PKG | grep squashfs-root | sed -e 's/squashfs-root//'`; do \
71+
[ -f $F -o -L $F ] && sudo rm -f $F; \
72+
done; \
73+
INSTALLED=$(echo -n $PKG | sed -e s/.tcz//); \
74+
sudo rm -f /usr/local/tce.installed/$INSTALLED; \
75+
done \
76+
&& sudo /sbin/ldconfig \
77+
&& rm -rf /tmp/tce/optional/*
78+
79+
# Instructions after here are run with 'root' user
80+
USER root
81+
82+
# install "virtualenv", since the vast majority of users of this image will want it
83+
RUN pip install virtualenv
84+
85+
CMD ["python2"]

2.7/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
IMAGE_NAME := tinycore-python
2+
IMAGE_TAG := 2.7
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
13+
docker images $(IMAGE_NAME) | grep -q latest && docker rmi $(IMAGE_NAME):latest || true

2.7/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:2.7
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 -r requirements.txt
8+
9+
ONBUILD COPY . /usr/src/app

2.7/onbuild/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
IMAGE_NAME := tinycore-python
2+
IMAGE_TAG := 2.7-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
13+
docker images $(IMAGE_NAME) | grep -q latest && docker rmi $(IMAGE_NAME):latest || true

3.4/Dockerfile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
FROM tatsushid/tinycore:6.0-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
8+
9+
ENV PYTHON_VERSION 3.4.2
10+
11+
RUN tce-load -wic gnupg curl
12+
&& rm -rf /tmp/tce/optional/*
13+
14+
# gpg: key F73C700D: public key "Larry Hastings <larry@hastings.org>" imported
15+
RUN gpg2 --keyserver pool.sks-keyservers.net --recv-keys 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
16+
17+
RUN tce-load -wic \
18+
flex \
19+
file \
20+
gcc \
21+
make \
22+
linux-3.16.2_api_headers \
23+
glibc_base-dev \
24+
openssl-1.0.0-dev \
25+
ncurses-dev \
26+
readline-dev \
27+
zlib_base-dev \
28+
&& cd /tmp \
29+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \
30+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \
31+
&& gpg2 --verify python.tar.xz.asc \
32+
&& rm python.tar.xz.asc \
33+
&& tar -xJf python.tar.xz \
34+
&& rm python.tar.xz \
35+
&& cd "/tmp/Python-$PYTHON_VERSION" \
36+
&& ./configure --enable-shared \
37+
&& make \
38+
&& mkdir tmp_install \
39+
&& make install DESTDIR=tmp_install \
40+
&& for F in `find tmp_install | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d :`; do \
41+
[ -f $F ] && strip --strip-unneeded $F; \
42+
done \
43+
&& for F in `find tmp_install | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d :`; do \
44+
[ -f $F ] && if [ ! -w $F ]; then chmod u+w $F && strip -g $F && chmod u-w $F; else strip -g $F; fi \
45+
done \
46+
&& for F in `find tmp_install | xargs file | grep "current ar archive" | cut -f 1 -d :`; do \
47+
[ -f $F ] && strip -g $F; \
48+
done \
49+
&& find tmp_install \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' + \
50+
&& find tmp_install \( -type d -a -name test -o -name tests \) | xargs rm -rf \
51+
&& $(cd tmp_install; sudo cp -R . /) \
52+
&& rm -rf "/tmp/Python-$PYTHON_VERSION" \
53+
&& cd /tmp/tce/optional \
54+
&& for PKG in `ls *-dev.tcz`; do \
55+
echo "Removing $PKG files"; \
56+
for F in `unsquashfs -l $PKG | grep squashfs-root | sed -e 's/squashfs-root//'`; do \
57+
[ -f $F -o -L $F ] && sudo rm -f $F; \
58+
done; \
59+
INSTALLED=$(echo -n $PKG | sed -e s/.tcz//); \
60+
sudo rm -f /usr/local/tce.installed/$INSTALLED; \
61+
done \
62+
&& for PKG in binutils.tcz \
63+
cloog.tcz \
64+
flex.tcz \
65+
gcc.tcz \
66+
gcc_libs.tcz \
67+
linux-3.16.2_api_headers.tcz \
68+
make.tcz; do \
69+
echo "Removing $PKG files"; \
70+
for F in `unsquashfs -l $PKG | grep squashfs-root | sed -e 's/squashfs-root//'`; do \
71+
[ -f $F -o -L $F ] && sudo rm -f $F; \
72+
done; \
73+
INSTALLED=$(echo -n $PKG | sed -e s/.tcz//); \
74+
sudo rm -f /usr/local/tce.installed/$INSTALLED; \
75+
done \
76+
&& sudo /sbin/ldconfig \
77+
&& rm -rf /tmp/tce/optional/*
78+
79+
# Instructions after here are run with 'root' user
80+
USER root
81+
82+
RUN cd /usr/local/bin \
83+
&& ln -s easy_install-3.4 easy_install \
84+
&& ln -s idel3 idle \
85+
&& ln -s pip3 pip \
86+
&& ln -s pydoc3 pydoc \
87+
&& ln -s python3 python \
88+
&& ln -s python3-config python-config
89+
90+
CMD ["python3"]

3.4/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
IMAGE_NAME := tinycore-python
2+
IMAGE_TAG := 3.4
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
13+
docker images $(IMAGE_NAME) | grep -q latest && docker rmi $(IMAGE_NAME):latest || true

3.4/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.4
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 -r requirements.txt
8+
9+
ONBUILD COPY . /usr/src/app

3.4/onbuild/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
IMAGE_NAME := tinycore-python
2+
IMAGE_TAG := 3.4-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
13+
docker images $(IMAGE_NAME) | grep -q latest && docker rmi $(IMAGE_NAME):latest || true

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Tatsushi Demachi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
PYTHON_DIRS := 3.4
2+
ONBUILD_DIRS := 3.4/onbuild
3+
4+
.PHONY: all clean $(PYTHON_DIRS) $(ONBUILD_DIRS)
5+
6+
all: $(PYTHON_DIRS) $(ONBUILD_DIRS)
7+
8+
clean: $(ONBUILD_DIRS) $(PYTHON_DIRS)
9+
10+
$(PYTHON_DIRS):
11+
$(MAKE) -C $@ $(MAKECMDGOALS)
12+
13+
$(ONBUILD_DIRS):
14+
$(MAKE) -C $@ $(MAKECMDGOALS)

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Python on Tiny Core Linux
2+
=========================
3+
4+
This provides a small but a fully functional [Python](https://www.python.org/) runtime environment. This image is based on my [Tiny Core Linux Docker image](https://registry.hub.docker.com/u/tatsushid/tinycore/).
5+
6+
## Supported tags and respective `Dockerfile` links
7+
8+
- [`2.7` (2.7/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/2.7/Dockerfile)
9+
- [`2.7-onbuild` (2.7/onbuild/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/2.7/onbuild/Dockerfile)
10+
- [`3.4` (3.4/Dockerfile)][Latest Dockerfile]
11+
- [`3.4-onbuild` (3.4/onbuild/Dockerfile)](https://github.com/tatsushid/docker-tinycore-python/blob/master/3.4/onbuild/Dockerfile)
12+
13+
## How to use this image
14+
15+
This can be used in the same way as [Official Python Image](https://registry.hub.docker.com/_/python/). Please see "How to use this image" section of it with replacing the image name with this one.
16+
17+
## How to install C extension etc.
18+
19+
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.
20+
21+
[Latest Dockerfile]: https://github.com/tatsushid/docker-tinycore-python/blob/master/3.4/Dockerfile

0 commit comments

Comments
 (0)