Loading .github/workflows/test.yml +24 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,18 @@ jobs: echo "Building image to test" ./build-and-test.sh Dockerfile-py3-linux linux-uv: runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v6.0.1 - name: Run Tests (uv) env: USE_UV_TEST: "1" run: | echo "Building image to test (uv)" ./build-and-test.sh Dockerfile-py3-linux linux-slim: runs-on: ubuntu-latest steps: Loading @@ -37,6 +49,18 @@ jobs: echo "Building image to test" ./build-and-test.sh Dockerfile-py3-linux-slim linux-slim-uv: runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v6.0.1 - name: Run Tests (uv) env: USE_UV_TEST: "1" run: | echo "Building image to test (uv)" ./build-and-test.sh Dockerfile-py3-linux-slim # osx: # runs-on: ubuntu-latest # steps: Loading Dockerfile-py3-linux +2 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ ENV PYTHONUNBUFFERED=1 # Copy the entrypoint script COPY entrypoint-linux.sh /entrypoint.sh # Install dependencies, PyInstaller, and set execute permissions for the entrypoint RUN pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION \ # Install dependencies, PyInstaller, uv, and set execute permissions for the entrypoint RUN pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION uv \ && chmod +x /entrypoint.sh # Set the working directory and mount the volume Loading Dockerfile-py3-linux-slim +2 −2 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ ENV PYTHONUNBUFFERED=1 # Copy entrypoint script early to ensure it’s available before dependency installation COPY entrypoint-linux.sh /entrypoint.sh # Install dependencies and PyInstaller in a single RUN command to reduce image layers # Install dependencies and PyInstaller/uv in a single RUN command to reduce image layers RUN apt update && \ apt install --no-install-recommends -y \ binutils \ gcc \ zlib1g-dev && \ rm -rf /var/lib/apt/lists/* && \ pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION && \ pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION uv && \ chmod +x /entrypoint.sh # Set the working directory and create a volume for source code Loading README.md +25 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,31 @@ will generate a `spec` file for `your-script.py` in your current working directo Add `pyinstaller==6.9.0` to your `requirements.txt`. ### How do I use uv instead of pip? `uv` is available in the Linux images. Set `USE_UV=1` to switch the dependency install step to `uv`: ```sh docker run \ --volume "$(pwd):/src/" \ --env USE_UV=1 \ batonogov/pyinstaller-linux:latest ``` If you use custom mirrors, you can pass `UV_INDEX_URL` and `UV_EXTRA_INDEX_URL`. When `USE_UV=1` is set, the entrypoint will also map `PYPI_INDEX_URL` to `UV_INDEX_URL` and `PYPI_URL` to `UV_EXTRA_INDEX_URL` if you did not provide them explicitly. ### Local testing note When running the test build (for example with `build-and-test.sh`), PyInstaller may emit warnings about optional DB drivers (like `MySQLdb`/`psycopg2`) or Windows DLLs (like `msvcrt`/`user32`) during Linux builds. These are expected for the test project; the build is successful if the binary is produced in `dist/`. ### Is it possible to use a package mirror? Yes, by supplying the `PYPI_URL` and `PYPI_INDEX_URL` environment variables that point to your PyPi mirror. Loading build-and-test.sh +5 −3 Original line number Diff line number Diff line Loading @@ -15,12 +15,14 @@ build_and_run() { local run_cmd=$2 local dockerfile=$3 local pyinstaller_args=${4:-"--onefile"} local use_uv=${5:-0} $build_cmd -f "$dockerfile" -t pyinstaller_test . && \ $run_cmd -v "$(pwd)/test:/src/" pyinstaller_test "pyinstaller main.py $pyinstaller_args" $run_cmd -v "$(pwd)/test:/src/" -e USE_UV="$use_uv" \ pyinstaller_test "pyinstaller main.py $pyinstaller_args" } if ! build_and_run "docker build" "docker run" "$1"; then if ! build_and_run "docker build" "docker run" "$1" "--onefile" "${USE_UV_TEST:-0}"; then echo "Docker build failed, trying Podman..." build_and_run "podman build" "podman run" "$1" build_and_run "podman build" "podman run" "$1" "--onefile" "${USE_UV_TEST:-0}" fi Loading
.github/workflows/test.yml +24 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,18 @@ jobs: echo "Building image to test" ./build-and-test.sh Dockerfile-py3-linux linux-uv: runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v6.0.1 - name: Run Tests (uv) env: USE_UV_TEST: "1" run: | echo "Building image to test (uv)" ./build-and-test.sh Dockerfile-py3-linux linux-slim: runs-on: ubuntu-latest steps: Loading @@ -37,6 +49,18 @@ jobs: echo "Building image to test" ./build-and-test.sh Dockerfile-py3-linux-slim linux-slim-uv: runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v6.0.1 - name: Run Tests (uv) env: USE_UV_TEST: "1" run: | echo "Building image to test (uv)" ./build-and-test.sh Dockerfile-py3-linux-slim # osx: # runs-on: ubuntu-latest # steps: Loading
Dockerfile-py3-linux +2 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ ENV PYTHONUNBUFFERED=1 # Copy the entrypoint script COPY entrypoint-linux.sh /entrypoint.sh # Install dependencies, PyInstaller, and set execute permissions for the entrypoint RUN pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION \ # Install dependencies, PyInstaller, uv, and set execute permissions for the entrypoint RUN pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION uv \ && chmod +x /entrypoint.sh # Set the working directory and mount the volume Loading
Dockerfile-py3-linux-slim +2 −2 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ ENV PYTHONUNBUFFERED=1 # Copy entrypoint script early to ensure it’s available before dependency installation COPY entrypoint-linux.sh /entrypoint.sh # Install dependencies and PyInstaller in a single RUN command to reduce image layers # Install dependencies and PyInstaller/uv in a single RUN command to reduce image layers RUN apt update && \ apt install --no-install-recommends -y \ binutils \ gcc \ zlib1g-dev && \ rm -rf /var/lib/apt/lists/* && \ pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION && \ pip install --no-cache-dir pyinstaller==$PYINSTALLER_VERSION uv && \ chmod +x /entrypoint.sh # Set the working directory and create a volume for source code Loading
README.md +25 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,31 @@ will generate a `spec` file for `your-script.py` in your current working directo Add `pyinstaller==6.9.0` to your `requirements.txt`. ### How do I use uv instead of pip? `uv` is available in the Linux images. Set `USE_UV=1` to switch the dependency install step to `uv`: ```sh docker run \ --volume "$(pwd):/src/" \ --env USE_UV=1 \ batonogov/pyinstaller-linux:latest ``` If you use custom mirrors, you can pass `UV_INDEX_URL` and `UV_EXTRA_INDEX_URL`. When `USE_UV=1` is set, the entrypoint will also map `PYPI_INDEX_URL` to `UV_INDEX_URL` and `PYPI_URL` to `UV_EXTRA_INDEX_URL` if you did not provide them explicitly. ### Local testing note When running the test build (for example with `build-and-test.sh`), PyInstaller may emit warnings about optional DB drivers (like `MySQLdb`/`psycopg2`) or Windows DLLs (like `msvcrt`/`user32`) during Linux builds. These are expected for the test project; the build is successful if the binary is produced in `dist/`. ### Is it possible to use a package mirror? Yes, by supplying the `PYPI_URL` and `PYPI_INDEX_URL` environment variables that point to your PyPi mirror. Loading
build-and-test.sh +5 −3 Original line number Diff line number Diff line Loading @@ -15,12 +15,14 @@ build_and_run() { local run_cmd=$2 local dockerfile=$3 local pyinstaller_args=${4:-"--onefile"} local use_uv=${5:-0} $build_cmd -f "$dockerfile" -t pyinstaller_test . && \ $run_cmd -v "$(pwd)/test:/src/" pyinstaller_test "pyinstaller main.py $pyinstaller_args" $run_cmd -v "$(pwd)/test:/src/" -e USE_UV="$use_uv" \ pyinstaller_test "pyinstaller main.py $pyinstaller_args" } if ! build_and_run "docker build" "docker run" "$1"; then if ! build_and_run "docker build" "docker run" "$1" "--onefile" "${USE_UV_TEST:-0}"; then echo "Docker build failed, trying Podman..." build_and_run "podman build" "podman run" "$1" build_and_run "podman build" "podman run" "$1" "--onefile" "${USE_UV_TEST:-0}" fi