1

I try to create a standalone python app using Pyinstaller which should run and can be reproducibly recreated on Windows, Linux, and Mac. The idea is to use Docker to have a fixed environment that creates the app and exports it again. For Linux and Windows, I could make it work using https://github.com/cdrx/docker-pyinstaller.

the idea is to let docker create a fully functioning pyinstaller app (with GUI) within and export this app. Since pyinstaller depends on the package versions etc. this should be fixed in the docker and only the new source code should be supplied to compile and export a new version of the software.

in the ideal scenario (and how it already works with Linux and Windows), the user can create the docker and compile the software itself:

docker build -t docker_pyinstaller_linux https://raw.githubusercontent.com/loipf/calimera_docker_export/main/linux/Dockerfile

docker run --rm -v "/path/to/app_source_code:/code/" -v "${PWD}:/code/dist/" docker_pyinstaller_linux

For Mac, however, there is no simple straightforward solution. There is one Mac docker image out there https://github.com/sickcodes/Docker-OSX, but the docker creation code is not that simple.

my idea:

  1. take https://github.com/sickcodes/Docker-OSX/blob/master/Dockerfile.auto

  2. add to the end the download of miniconda:

RUN chmod -R 777 /Users/user

### install miniconda to /miniconda
RUN curl -LO "http://repo.continuum.io/miniconda/Miniconda3-4.4.10-MacOSX-x86_64.sh"
RUN bash Miniconda3-4.4.10-MacOSX-x86_64.sh -p /miniconda -b
ENV PATH=/miniconda/bin:${PATH}
RUN conda update -y conda

### install packages from conda 
RUN conda install -c anaconda -y python=3.8
RUN apt-get install -y python3-pyqt5
... 

but already the first command fails due to chmod: cannot access '/Users/user': No such file or directory since I am in a different "environment" than the interactive session (/home/arch/OSX-KVM). Can somebody help me out?

I know these asking for code pieces questions are not the best, and I could show you all the things I tried, but I doubt they will help anybody. I would like to have a minimum Mac example without user login or gui etc (which should be possible using https://github.com/sickcodes/osx-optimizer). It should only have miniconda installed (with pyinstaller and a few packages).


other info: I can run the previous commands in the mac environment interactively in the docker environment but would like to fix these commands permanently in the image:

docker pull sickcodes/docker-osx:auto    ### replace with docker with pyinstaller and packages
docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    sickcodes/docker-osx:auto

ideally in the end, we can run the above command with OSX_commands pyinstaller file.spec



related questions but without solution:

teste
  • 19
  • 2
  • Python is preinstalled on two of the three operating systems you list; Docker won't be installed by default on any of them without the end user manually installing it. Would distributing a native Python package work better? If this process worked perfectly, what would you put into it and what would come out – David Maze Oct 03 '22 at 01:17
  • I edited the question and made my point and idea clearer, hopefully this helps. if it works perfectly (like for Linux and Windows) you supply the new source code to the docker. The docker runs pyinstaller internally and exports a running software back to the original environment (see added code piece in question) – teste Oct 03 '22 at 08:15

0 Answers0