PyInstaller for Linux inside Docker
1.2K
This is a fork of cdrx/pyinstaller-linux, with the following changes:
engineervix/pyinstaller-linux is a Docker container to ease compiling Python applications to Linux binaries.
Current PyInstaller version used: 4.0.
engineervix/pyinstaller-linux has three tags; :python3, :python3-32bit and :python2 which you can use depending on the requirements of your project. :latest points to :python3
The :python2 tag runs Python 2.7.
The :python3 and :python3-32bit tags run Python 3.7.
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/" engineervix/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/" --entrypoint /bin/sh engineervix/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.
docker run -v "$(pwd):/src/" engineervix/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=X.Y.Z to your requirements.txt (where X.Y.Z represents the version).
Yes, by supplying the PYPI_URL and PYPI_INDEX_URL environment variables that point to your PyPi mirror.
You tell me!
MIT
Content type
Image
Digest
Size
246.5 MB
Last updated
almost 6 years ago
docker pull engineervix/pyinstaller-linux