six8 / pyinstaller-alpine

Docker image that can build single file Python apps with PyInstaller for Alpine Linux.
MIT License
80 stars 44 forks source link

Dockerhub images for latest pyinstaller and alive python versions #7

Open chaoflow opened 5 years ago

chaoflow commented 5 years ago

It would be great to have images on dockerhub for all alive supported python versions and at least the latest released pyinstaller.

Personally, I'm most interested in pyinstaller v3.5 with Python 3.7.

six8 commented 5 years ago

What version of Alpine? Or does that matter? Right now it just uses whatever Alpine packages for Python. It would be nice if I could get circleci to iterate some versions of Alpine + some versions of pyinstaller without having to specify each combination.

chaoflow commented 5 years ago

@six8 It seems it is now sufficient to compile the bootloader and then install via pip.

FROM python:3.7-alpine

RUN apk add --no-cache curl gcc g++ libc-dev musl-dev libffi-dev zlib-dev
RUN curl -L https://github.com/pyinstaller/pyinstaller/releases/download/v3.5/PyInstaller-3.5.tar.gz | tar xz
# TODO: Warnings disabled due to https://github.com/pyinstaller/pyinstaller/pull/4219
RUN cd PyInstaller-*/bootloader && \
    CFLAGS="-Wno-stringop-overflow" ./waf configure all && \
    pip install ..
RUN echo -e "#!/usr/bin/env python\nprint('Hallo')" > example
RUN pyinstaller -F example
RUN ./dist/example

What was/is the purpose of the ldd-wrapper? If it is sufficient to compile the bootloader, it makes more sense to me to provide wheels for musl on pypi (by pyinstaller itself).

six8 commented 5 years ago

Wheel does not differentiate between musl and glibc (at least last time I checked). The wheel format doesn't specify which C lib is being used to build the wheel. They're all tagged with "cp37" in the wheel name.

chaoflow commented 5 years ago

Maybe a dedicated pyinstaller-alpine or pyinstaller-musl pypi package?

Providing images could mean doing that based on many of the official python ones

gsemet commented 5 years ago

Hello. Could be cool indeed to have a base image with pyinstaller 3.5 installed, using your snippet for instance. That would avoid doing over and over the same installation on our different projects :)

chaoflow commented 5 years ago

pyinstaller installed from source on aarch64 glibc is building the bootloader and works correctly. Why is it that we need to jump through hoops to get it running for musl? Can't we teach it to compile the correct way when being installed on a musl system (alpine)?

six8 commented 7 months ago

https://peps.python.org/pep-0656/ Introduced the musllinux tag in 2021. So, now there is a way to correctly identify and install musl wheels.