Skip to content

Commit

Permalink
Add libffi-dev to images
Browse files Browse the repository at this point in the history
  • Loading branch information
jfloff committed Mar 11, 2019
1 parent 6cc8813 commit 2682e39
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 24 deletions.
6 changes: 4 additions & 2 deletions 2.7-onbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
6 changes: 4 additions & 2 deletions 2.7-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
6 changes: 4 additions & 2 deletions 2.7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
6 changes: 4 additions & 2 deletions 3.6-onbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
6 changes: 4 additions & 2 deletions 3.6-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
6 changes: 4 additions & 2 deletions 3.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
6 changes: 4 additions & 2 deletions 3.7-onbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
6 changes: 4 additions & 2 deletions 3.7-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
9 changes: 7 additions & 2 deletions 3.7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \
git \
ca-certificates \
libssl1.0 \
libffi-dev \
" \
# PACKAGES needed to built python
PYTHON_BUILD_PACKAGES="\
Expand Down Expand Up @@ -78,15 +79,19 @@ RUN set -ex ;\
git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\
# install
GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# flag explanation:
# --with-shared : python-dev
PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\
# keep the needed .so files
# ignore libpython - that one comes from the pyenv instalation
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| grep -vE '*libpython*' \
| grep -ve 'libpython' \
| xargs -rt apk add --no-cache --virtual .python-rundeps ;\
# for debug
# | xargs -n1 echo ;\
# delete everything from pyenv except the installed version
# this throws an error but we ignore it
find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,31 @@ The default docker python images are too [big](https://github.com/docker-library

|REPOSITORY|TAG|SIZE|
|-|-|-|
|jfloff/alpine-python|2.7-slim|58.9MB|
|jfloff/alpine-python|2.7-slim|62.4MB|
|python|2.7-slim|120MB|
|python|2.7-alpine|61.2MB|
||||
|jfloff/alpine-python|2.7|233MB|
|jfloff/alpine-python|2.7|236MB|
|python|2.7|912MB|
||||
|jfloff/alpine-python|3.6-slim|75.1MB|
|jfloff/alpine-python|3.6-slim|78.8MB|
|python|3.6-slim|138MB|
|python|3.6-alpine|79MB|
||||
|jfloff/alpine-python|3.6|249MB|
|jfloff/alpine-python|3.6|253MB|
|python|3.6|922MB|
||||
|jfloff/alpine-python|3.7-slim|79.2MB|
|jfloff/alpine-python|3.7-slim|82.9MB|
|python|3.7-slim|86.7MB|
|python|3.7-alpine|143MB|
||||
|jfloff/alpine-python|3.7|254MB|
|jfloff/alpine-python|3.7|257MB|
|python|3.7|927MB|

2.7-slim 62.4MB
2.7-onbuild 236MB
2.7 236MB

Perhaps this could be even smaller, but I'm not an Alpine guru. **Feel free to post a PR.**

## Details
Expand Down

0 comments on commit 2682e39

Please sign in to comment.