Commit 18d9a7cb authored by Fedor Batonogov's avatar Fedor Batonogov
Browse files

Updated Python to 3.9.2 and PyInstaller to 4.2

parent 98016b4b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
FROM ubuntu:12.04
SHELL ["/bin/bash", "-i", "-c"]

ARG PYTHON_VERSION=3.7.5
ARG PYINSTALLER_VERSION=3.6
LABEL maintainer="batonogov@icloud.com"

ARG PYTHON_VERSION=3.9.2
ARG PYINSTALLER_VERSION=4.2

ENV PYPI_URL=https://pypi.python.org/
ENV PYPI_INDEX_URL=https://pypi.python.org/simple
+4 −2
Original line number Diff line number Diff line
FROM i386/ubuntu:12.04
SHELL ["/bin/bash", "-i", "-c"]

ARG PYTHON_VERSION=3.7.5
ARG PYINSTALLER_VERSION=3.6
LABEL maintainer="batonogov@icloud.com"

ARG PYTHON_VERSION=3.9.2
ARG PYINSTALLER_VERSION=4.2

ENV PYPI_URL=https://pypi.python.org/
ENV PYPI_INDEX_URL=https://pypi.python.org/simple
+14 −12
Original line number Diff line number Diff line
FROM ubuntu:16.04

LABEL maintainer="batonogov@icloud.com"

ENV DEBIAN_FRONTEND noninteractive

ARG WINE_VERSION=winehq-staging
ARG PYTHON_VERSION=3.7.5
ARG PYINSTALLER_VERSION=3.6
ARG WINE_VERSION=winehq-stable
ARG PYTHON_VERSION=3.9.2
ARG PYINSTALLER_VERSION=4.2

# we need wine for this all to work, so we'll use the PPA
RUN set -x \
@@ -34,20 +36,20 @@ ENV PYPI_INDEX_URL=https://pypi.python.org/simple
# install python in wine, using the msi packages to install, extracting
# the files directly, since installing isn't running correctly.
RUN set -x \
    && winetricks win7 \
    && winetricks win10 \
    && 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:/Python39; \
        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/Python39 \
    && echo 'wine '\''C:\Python39\python.exe'\'' "$@"' > /usr/bin/python \
    && echo 'wine '\''C:\Python39\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \
    && echo 'wine '\''C:\Python39\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \
    && echo 'wine '\''C:\Python39\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \
    && echo 'wine '\''C:\Python39\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:\Python39\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) \
+14 −12
Original line number Diff line number Diff line
FROM ubuntu:16.04

LABEL maintainer="batonogov@icloud.com"

ENV DEBIAN_FRONTEND noninteractive

ARG WINE_VERSION=winehq-staging
ARG PYTHON_VERSION=3.7.5
ARG PYINSTALLER_VERSION=3.6
ARG WINE_VERSION=winehq-stable
ARG PYTHON_VERSION=3.9.2
ARG PYINSTALLER_VERSION=4.2

# we need wine for this all to work, so we'll use the PPA
RUN set -x \
@@ -34,20 +36,20 @@ ENV PYPI_INDEX_URL=https://pypi.python.org/simple
# install python in wine, using the msi packages to install, extracting
# the files directly, since installing isn't running correctly.
RUN set -x \
    && winetricks win7 \
    && winetricks win10 \
    && 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:/Python39; \
        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/Python39 \
    && echo 'wine '\''C:\Python39\python.exe'\'' "$@"' > /usr/bin/python \
    && echo 'wine '\''C:\Python39\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \
    && echo 'wine '\''C:\Python39\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \
    && echo 'wine '\''C:\Python39\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \
    && echo 'wine '\''C:\Python39\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:\Python39\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) \
+16 −10
Original line number Diff line number Diff line
# PyInstaller Docker Images

**cdrx/pyinstaller-linux** and **cdrx/pyinstaller-windows** are a pair of Docker containers to ease compiling Python applications to binaries / exe files.
**batonogov/pyinstaller-linux** and **batonogov/pyinstaller-windows** are a pair of Docker containers to ease compiling Python applications to binaries / exe files.

Current PyInstaller version used: 3.6.
Current PyInstaller version used: 
- 4.2 for Python 3.9 
- 3.6 for Python 2.7

## Tags

`cdrx/pyinstaller-linux` and `cdrx/pyinstaller-windows` both have two tags, `:python2` and `:python3` which you can use depending on the requirements of your project. `:latest` points to `:python3`
`batonogov/pyinstaller-linux` and `batonogov/pyinstaller-windows` both have two tags, `:python3` and `:python2` which you can use depending on the requirements of your project. `:latest` points to `:python3`

The `:python2` tags run Python 2.7.
The `:python3` tag runs Python 3.9.

The `:python3` tag runs Python 3.7.
The `:python2` tags run Python 2.7.

## Usage

@@ -25,13 +27,13 @@ If the `src` folder has a `requirements.txt` file, the packages will be installe
For example, in the folder that has your source code, `.spec` file and `requirements.txt`:

```
docker run -v "$(pwd):/src/" cdrx/pyinstaller-windows
docker run -v "$(pwd):/src/" batonogov/pyinstaller-windows
```

will build your PyInstaller project into `dist/windows/`. The `.exe` file will have the same name as your `.spec` file.

```
docker run -v "$(pwd):/src/" cdrx/pyinstaller-linux
docker run -v "$(pwd):/src/" batonogov/pyinstaller-linux
```

will build your PyInstaller project into `dist/linux/`. The binary will have the same name as your `.spec` file.
@@ -41,20 +43,20 @@ will build your PyInstaller project into `dist/linux/`. The binary will have the
You'll need to supply a custom command to Docker to install system pacakges. Something like:

```
docker run -v "$(pwd):/src/" --entrypoint /bin/sh cdrx/pyinstaller-linux -c "apt-get update -y && apt-get install -y wget && /entrypoint.sh"
docker run -v "$(pwd):/src/" --entrypoint /bin/sh batonogov/pyinstaller-linux -c "apt-get update -y && apt-get install -y wget && /entrypoint.sh"
```

Replace `wget` with the dependencies / package(s) you need to install.

##### How do I generate a .spec file?

`docker run -v "$(pwd):/src/" cdrx/pyinstaller-linux "pyinstaller your-script.py"`
`docker run -v "$(pwd):/src/" batonogov/pyinstaller-linux "pyinstaller your-script.py"`

will generate a `spec` file for `your-script.py` in your current working directory. See the PyInstaller docs for more information.

##### How do I change the PyInstaller version used?

Add `pyinstaller=3.1.1` to your `requirements.txt`.
Add `pyinstaller=4.1` to your `requirements.txt`.

##### Is it possible to use a package mirror?

@@ -102,6 +104,10 @@ Updated PyInstaller to version 3.4
Added a 32bit package, thank you @danielguardicore
Updated PyInstaller to version 3.6

#### [2.0] - 2021-03-11
Drop support for Python 2.7
Updated Python 3 to version 3.9.2
Updated PyInstaller to version 4.2

## License