8000 GitHub - joaompinto/docker-build-python-static-bin: Docker image that allows to build static binaries for Python applications
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

joaompinto/docker-build-python-static-bin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build a static binary from a Python script

The Docker image available on this repository allows to build Linux static binaries from python scripts/applications. This binaries should run fine on any Linux system (x64 only).

The binary is built using Nuitka together with a Python 3.10 static build.

The build logic was adapted from https://github.com/xxh/xxh .

How to use this repository (from source)

Create the docker image

docker build . -t build-python-bin

Create a hello world script (test.py)

print("Hello world from static python")

Create the static binary

docker run --user $(id -u) -v $(pwd):/build -it build-python-bin test.py

# Resulting binary will be at test.dist/test, rename, check and cleanup
mv test.dist/test my_static_binary
file my_static_binary
rm -rf test.dist/

Test it in some docker images (not containing Python):

docker run -v $(pwd):/tmp -it alpine /tmp/my_static_binary
docker run -v $(pwd):/tmp -it debian /tmp/my_static_binary
docker run -v $(pwd):/tmp -it ubuntu /tmp/my_static_binary
< 6189 !-- -->

About

Docker image that allows to build static binaries for Python applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
0