Coder Social home page Coder Social logo

scys / pyinstaller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from six8/pyinstaller-alpine

1.0 3.0 0.0 22 KB

Docker image that can build single file Python apps with PyInstaller for Alpine Linux.

License: MIT License

Shell 49.38% Dockerfile 50.62%

pyinstaller's Introduction

PyInstaller

Docker image that can build single file Python apps with PyInstaller for Alpine Linux.

Alpine uses musl instead of glibc. The PyInstaller bootloader for Linux 64 that comes with PyInstaller is made for glibc. This Docker image builds a bootloader with musl.

This Docker image also provides a clean way to build PyInstaller apps in an isolated environment.

Usage

Building A PyInstaller Package

To build a Python package, create a Docker container with your source mounted as a volume at /src:

docker run --rm \
    -v "${PWD}:/src" \
    six8/pyinstaller-alpine \
    --noconfirm \
    --onefile \
    --log-level DEBUG \
    --clean \
    example.py

If a requirements.txt file is found in your source directory, the requirements will automatically be installed with pip.

This will output a built app to the dist sub-directory in your source directory. The app can be ran on an Alpine OS:

./dist/example

Encrypting Your App

You can use PyInstaller to obfuscate your source with encryption. To use a specific key, pass a 16 character string with the --key {key-string} parameter. A non-standard feature of this Docker image is that you can use --random-key to use a random key:

docker run --rm \
    -v "${PWD}:/src" \
    six8/pyinstaller-alpine \
    --onefile \
    --random-key \
    --clean \
    example.py

Reproducible Build

If you want a Reproducible Build when your source has not changed, you can pass a PYTHONHASHSEED env var for consistent randomization for internal data structures:

docker run --rm \
    -v "${PWD}:/src" \
    -e PYTHONHASHSEED=42 \
    six8/pyinstaller-alpine \
    --onefile \
    --clean \
    example.py

cksum dist/example | awk '{print $1}'

Building Docker Image

If you'd like to build the Docker image yourself:

./build.sh

pyinstaller's People

Contributors

mattrasband avatar scys avatar six8 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.