Skip to content

Instantly share code, notes, and snippets.

@0atman
Created September 2, 2020 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0atman/7e1542f4b8f2ef453c5fec83ffc0c6c1 to your computer and use it in GitHub Desktop.
Save 0atman/7e1542f4b8f2ef453c5fec83ffc0c6c1 to your computer and use it in GitHub Desktop.
pyinstaller works well!
λ python hello.py
hi
λ pyinstaller hello.py
18 INFO: PyInstaller: 4.0
18 INFO: Python: 3.8.2
24 INFO: Platform: Linux-5.4.0-45-generic-x86_64-with-glibc2.29
24 INFO: wrote /home/oatman/projects/pyinsttest/hello.spec
26 INFO: UPX is available.
[...]
λ cd dist/hello
λ la hello
-rwxr-xr-x 1 oatman oatman 1.9M Sep 2 15:26 hello*
λ ldd hello
linux-vdso.so.1 (0x00007ffe5bdf1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5624dc4000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f5624da8000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5624bb6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5624deb000)
λ docker run -v (pwd):/app -it ubuntu
root@88fb349f1398:/# /app/hello
hi
@0atman
Copy link
Author

0atman commented Sep 2, 2020

Make the exe static with staticx!

λ la app.static
-rwx------ 1 oatman oatman 11M Sep  2 17:01 app.static*

λ docker run -v (pwd):/app -it alpine
/ # /app/app.static
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 694-188-683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment