PyInstaller for Linux & Windows inside Docker
335
yshalsager/pyinstaller is a fork from cdrx/docker-pyinstaller, Docker containers to ease compiling Python applications to binaries / exe files. This fork uses python 3 only, updated to 3.7 for linux, and updated PyInstaller 3.4, in addition to using -F flag to get standalone files.
Current PyInstaller version used: 3.4.
There are two containers, one for Linux and one for Windows builds. The Windows builder runs Wine inside Ubuntu to emulate Windows in Docker.
To build your application, you need to mount your source code into the /src/ volume.
The source code directory should have your .spec file that PyInstaller generates. If you don't have one, you'll need to run PyInstaller once locally to generate it.
If the src folder has a requirements.txt file, the packages will be installed into the environment before PyInstaller runs.
For example, in the folder that has your source code, .spec file and requirements.txt:
docker run -v "$(pwd):/src/" cdrx/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
will build your PyInstaller project into dist/linux/. The binary will have the same name as your .spec file.
You'll need to supply a custom command to Docker to install system pacakges. Something like:
docker run -v "$(pwd):/src/" cdrx/pyinstaller-linux "apt-get update -y && apt-get install -y wget && pip install -r requirements.txt && pyinstaller --clean -y --dist ./dist/linux --workpath /tmp *.spec"
Replace wget with the dependencies / package(s) you need to install.
docker run -v "$(pwd):/src/" cdrx/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.
Add pyinstaller=3.1.1 to your requirements.txt.
Yes, by supplying the PYPI_URL and PYPI_INDEX_URL environment variables that point to your PyPi mirror.
None
First release, works.
Added Python 3.4 on Windows, thanks to @bmustiata
Added Python 3.5 on Windows, thanks (again) to @bmustiata
Upgraded PyInstaller to version 3.2.1. Thanks to @bmustiata for contributing:
Fixed bug with concatenated commands in entrypoint arguments, thanks to @alph4
Changed the default PyInstaller version to 3.3
Added Python 3.6 on Windows, thanks to @jameshilliard
Bumped Python version to 3.6 on Linux, thank you @itouch5000
MIT
Content type
Image
Digest
Size
394.5 MB
Last updated
almost 8 years ago
docker pull yshalsager/docker-pyinstaller:windows