diff --git a/Dockerfile-py2-amd64 b/Dockerfile-py2-precise-amd64 similarity index 100% rename from Dockerfile-py2-amd64 rename to Dockerfile-py2-precise-amd64 diff --git a/Dockerfile-py2-win32 b/Dockerfile-py2-trusty-win32 similarity index 100% rename from Dockerfile-py2-win32 rename to Dockerfile-py2-trusty-win32 diff --git a/Dockerfile-py3-focal-amd64 b/Dockerfile-py3-focal-amd64 new file mode 100644 index 0000000..872b6fb --- /dev/null +++ b/Dockerfile-py3-focal-amd64 @@ -0,0 +1,56 @@ +FROM ubuntu:20.04 +SHELL ["/bin/bash", "-i", "-c"] + +ARG PYTHON_VERSION=3.7.5 +ARG PYINSTALLER_VERSION=3.6 + +ENV PYPI_URL=https://pypi.python.org/ +ENV PYPI_INDEX_URL=https://pypi.python.org/simple +ENV PYENV_VERSION=${PYTHON_VERSION} + +COPY entrypoint-linux.sh /entrypoint.sh + +RUN \ + set -x \ + # update system + && apt-get update \ + # install requirements + && apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + wget \ + git \ + libbz2-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + zlib1g-dev \ + libffi-dev \ + #optional libraries + libgdbm-dev \ + libgdbm6 \ + uuid-dev \ + #upx + upx \ + libssl-dev \ + # install pyenv + && echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc \ + && echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc \ + && source ~/.bashrc \ + && curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash \ + && echo 'eval "$(pyenv init -)"' >> ~/.bashrc \ + && source ~/.bashrc \ + # install python + && CONFIGURE_OPTS=--enable-shared pyenv install $PYTHON_VERSION \ + && pyenv global $PYTHON_VERSION \ + && pip install --upgrade pip \ + # install pyinstaller + && pip install pyinstaller==$PYINSTALLER_VERSION \ + && mkdir /src/ \ + && chmod +x /entrypoint.sh + +VOLUME /src/ +WORKDIR /src/ + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/Dockerfile-py3-amd64 b/Dockerfile-py3-precise-amd64 similarity index 100% rename from Dockerfile-py3-amd64 rename to Dockerfile-py3-precise-amd64 diff --git a/Dockerfile-py3-i386 b/Dockerfile-py3-precise-i386 similarity index 100% rename from Dockerfile-py3-i386 rename to Dockerfile-py3-precise-i386 diff --git a/Dockerfile-py3-xenial-amd64 b/Dockerfile-py3-xenial-amd64 new file mode 100644 index 0000000..621d68d --- /dev/null +++ b/Dockerfile-py3-xenial-amd64 @@ -0,0 +1,56 @@ +FROM ubuntu:16.04 +SHELL ["/bin/bash", "-i", "-c"] + +ARG PYTHON_VERSION=3.7.5 +ARG PYINSTALLER_VERSION=3.6 + +ENV PYPI_URL=https://pypi.python.org/ +ENV PYPI_INDEX_URL=https://pypi.python.org/simple +ENV PYENV_VERSION=${PYTHON_VERSION} + +COPY entrypoint-linux.sh /entrypoint.sh + +RUN \ + set -x \ + # update system + && apt-get update \ + # install requirements + && apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + wget \ + git \ + libbz2-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + zlib1g-dev \ + libffi-dev \ + #optional libraries + libgdbm-dev \ + libgdbm3 \ + uuid-dev \ + #upx + upx \ + libssl-dev \ + # install pyenv + && echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc \ + && echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc \ + && source ~/.bashrc \ + && curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash \ + && echo 'eval "$(pyenv init -)"' >> ~/.bashrc \ + && source ~/.bashrc \ + # install python + && CONFIGURE_OPTS=--enable-shared pyenv install $PYTHON_VERSION \ + && pyenv global $PYTHON_VERSION \ + && pip install --upgrade pip \ + # install pyinstaller + && pip install pyinstaller==$PYINSTALLER_VERSION \ + && mkdir /src/ \ + && chmod +x /entrypoint.sh + +VOLUME /src/ +WORKDIR /src/ + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/Dockerfile-py3-win32 b/Dockerfile-py3-xenial-win32 similarity index 83% rename from Dockerfile-py3-win32 rename to Dockerfile-py3-xenial-win32 index 89787b0..1642cb1 100644 --- a/Dockerfile-py3-win32 +++ b/Dockerfile-py3-xenial-win32 @@ -37,17 +37,17 @@ RUN set -x \ && winetricks win7 \ && for msifile in `echo core dev exe lib path pip tcltk tools`; do \ wget -nv "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi"; \ - wine msiexec /i "${msifile}.msi" /qb TARGETDIR=C:/Python37; \ + wine msiexec /i "${msifile}.msi" /qb TARGETDIR=C:/Python; \ rm ${msifile}.msi; \ done \ - && cd /wine/drive_c/Python37 \ - && echo 'wine '\''C:\Python37\python.exe'\'' "$@"' > /usr/bin/python \ - && echo 'wine '\''C:\Python37\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \ - && echo 'wine '\''C:\Python37\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \ - && echo 'wine '\''C:\Python37\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \ - && echo 'wine '\''C:\Python37\Scripts\pyupdater.exe'\'' "$@"' > /usr/bin/pyupdater \ + && cd /wine/drive_c/Python \ + && echo 'wine '\''C:\Python\python.exe'\'' "$@"' > /usr/bin/python \ + && echo 'wine '\''C:\Python\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \ + && echo 'wine '\''C:\Python\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \ + && echo 'wine '\''C:\Python\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \ + && echo 'wine '\''C:\Python\Scripts\pyupdater.exe'\'' "$@"' > /usr/bin/pyupdater \ && echo 'assoc .py=PythonScript' | wine cmd \ - && echo 'ftype PythonScript=c:\Python37\python.exe "%1" %*' | wine cmd \ + && echo 'ftype PythonScript=c:\Python\python.exe "%1" %*' | wine cmd \ && while pgrep wineserver >/dev/null; do echo "Waiting for wineserver"; sleep 1; done \ && chmod +x /usr/bin/python /usr/bin/easy_install /usr/bin/pip /usr/bin/pyinstaller /usr/bin/pyupdater \ && (pip install -U pip || true) \ diff --git a/Dockerfile-py3-win64 b/Dockerfile-py3-xenial-win64 similarity index 83% rename from Dockerfile-py3-win64 rename to Dockerfile-py3-xenial-win64 index e98284e..93f25c9 100644 --- a/Dockerfile-py3-win64 +++ b/Dockerfile-py3-xenial-win64 @@ -37,17 +37,17 @@ RUN set -x \ && winetricks win7 \ && for msifile in `echo core dev exe lib path pip tcltk tools`; do \ wget -nv "https://www.python.org/ftp/python/$PYTHON_VERSION/amd64/${msifile}.msi"; \ - wine msiexec /i "${msifile}.msi" /qb TARGETDIR=C:/Python37; \ + wine msiexec /i "${msifile}.msi" /qb TARGETDIR=C:/Python; \ rm ${msifile}.msi; \ done \ - && cd /wine/drive_c/Python37 \ - && echo 'wine '\''C:\Python37\python.exe'\'' "$@"' > /usr/bin/python \ - && echo 'wine '\''C:\Python37\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \ - && echo 'wine '\''C:\Python37\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \ - && echo 'wine '\''C:\Python37\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \ - && echo 'wine '\''C:\Python37\Scripts\pyupdater.exe'\'' "$@"' > /usr/bin/pyupdater \ + && cd /wine/drive_c/Python \ + && echo 'wine '\''C:\Python\python.exe'\'' "$@"' > /usr/bin/python \ + && echo 'wine '\''C:\Python\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \ + && echo 'wine '\''C:\Python\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \ + && echo 'wine '\''C:\Python\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \ + && echo 'wine '\''C:\Python\Scripts\pyupdater.exe'\'' "$@"' > /usr/bin/pyupdater \ && echo 'assoc .py=PythonScript' | wine cmd \ - && echo 'ftype PythonScript=c:\Python37\python.exe "%1" %*' | wine cmd \ + && echo 'ftype PythonScript=c:\Python\python.exe "%1" %*' | wine cmd \ && while pgrep wineserver >/dev/null; do echo "Waiting for wineserver"; sleep 1; done \ && chmod +x /usr/bin/python /usr/bin/easy_install /usr/bin/pip /usr/bin/pyinstaller /usr/bin/pyupdater \ && (pip install -U pip || true) \ diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..aec9b43 --- /dev/null +++ b/build.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +# Run NAMESPACE=custom ./build.sh to customize images namespace +NAMESPACE=${NAMESPACE-cdrx} + +echo "Building Default Linux image (Python 3, Precise, 64bit)" +docker build -f Dockerfile-py3-precise-amd64 \ +-t $NAMESPACE/pyinstaller-linux \ +-t $NAMESPACE/pyinstaller-linux:64bit \ +-t $NAMESPACE/pyinstaller-linux:python3 \ +-t $NAMESPACE/pyinstaller-linux:precise \ +-t $NAMESPACE/pyinstaller-linux:python3-64bit \ +-t $NAMESPACE/pyinstaller-linux:python3-precise \ +-t $NAMESPACE/pyinstaller-linux:python3-precise-64bit \ +. + +echo "Building Default Windows image (Python 3, Xenial, 64bit)" +docker build -f Dockerfile-py3-xenial-win64 \ +-t $NAMESPACE/pyinstaller-windows \ +-t $NAMESPACE/pyinstaller-windows:64bit \ +-t $NAMESPACE/pyinstaller-windows:xenial \ +-t $NAMESPACE/pyinstaller-windows:python3 \ +-t $NAMESPACE/pyinstaller-windows:python3-64bit \ +-t $NAMESPACE/pyinstaller-windows:python3-xenial \ +-t $NAMESPACE/pyinstaller-windows:python3-xenial-64bit \ +. + +echo "Building Default Linux 32 bits image (Python 3, Precise, 32bit)" +docker build -f Dockerfile-py3-precise-i386 \ +-t $NAMESPACE/pyinstaller-linux:32bit \ +-t $NAMESPACE/pyinstaller-linux:python3-32bit \ +-t $NAMESPACE/pyinstaller-linux:python3-precise-32bit \ +. + +echo "Building Default Windows 32 bits image (Python 3, Xenial, 32bit)" +docker build -f Dockerfile-py3-xenial-win32 \ +-t $NAMESPACE/pyinstaller-windows:32bit \ +-t $NAMESPACE/pyinstaller-windows:python3-32bit \ +-t $NAMESPACE/pyinstaller-windows:python3-xenial-32bit \ +. + +echo "Building Default Windows Python 2 image (Python 2, Trusty, 32bit)" +docker build -f Dockerfile-py2-trusty-win32 \ +-t $NAMESPACE/pyinstaller-linux:python2 \ +-t $NAMESPACE/pyinstaller-linux:python2-trusty \ +-t $NAMESPACE/pyinstaller-linux:python2-32bit \ +-t $NAMESPACE/pyinstaller-linux:python2-trusty-32bit \ +. + +echo "Building Default Linux Python 2 image (Python 2, Precise, 64bit)" +docker build -f Dockerfile-py2-precise-amd64 \ +-t $NAMESPACE/pyinstaller-linux:python2 \ +-t $NAMESPACE/pyinstaller-linux:python2-precise \ +-t $NAMESPACE/pyinstaller-linux:python2-precise-64bit \ +. + +echo "Building Default Linux Focal image (Python 3, Focal, 64bit)" +docker build -f Dockerfile-py3-focal-amd64 \ +-t $NAMESPACE/pyinstaller-linux:focal \ +-t $NAMESPACE/pyinstaller-linux:python3-focal \ +-t $NAMESPACE/pyinstaller-linux:python3-focal-64bit \ +. + +echo "Building Default Linux Xenial image (Python 3, Xenial, 64bit)" +docker build -f Dockerfile-py3-xenial-amd64 \ +-t $NAMESPACE/pyinstaller-linux:xenial \ +-t $NAMESPACE/pyinstaller-linux:python3-xenial \ +-t $NAMESPACE/pyinstaller-linux:python3-xenial-64bit \ +. diff --git a/entrypoint-linux.sh b/entrypoint-linux.sh index 5eac72d..9c5bb8b 100644 --- a/entrypoint-linux.sh +++ b/entrypoint-linux.sh @@ -31,9 +31,9 @@ fi cd $WORKDIR -if [ -f requirements.txt ]; then +if [ -f requirements.txt ] && [ -z "$DISABLE_REQUIREMENTS" ]; then pip install -r requirements.txt -fi # [ -f requirements.txt ] +fi echo "$@" diff --git a/entrypoint-windows.sh b/entrypoint-windows.sh index c828d50..217d4c9 100755 --- a/entrypoint-windows.sh +++ b/entrypoint-windows.sh @@ -31,9 +31,9 @@ fi cd $WORKDIR -if [ -f requirements.txt ]; then +if [ -f requirements.txt ] && [ -z "$DISABLE_REQUIREMENTS" ]; then pip install -r requirements.txt -fi # [ -f requirements.txt ] +fi echo "$@"