|
| 1 | +FROM ubuntu:bionic |
| 2 | + |
| 3 | +ENV DEBIAN_FRONTEND noninteractive |
| 4 | + |
| 5 | +ARG WINE_VERSION=stable |
| 6 | +ARG PYTHON_VERSION=3.7.9 |
| 7 | +ARG PYINSTALLER_VERSION=4.0 |
| 8 | + |
| 9 | +# we need wine for this all to work, so we'll use the PPA |
| 10 | +RUN set -x \ |
| 11 | + && dpkg --add-architecture i386 \ |
| 12 | + && apt-get update -qy \ |
| 13 | + && apt-get install --no-install-recommends -qfy apt-transport-https software-properties-common wget gpg-agent rename \ |
| 14 | + && wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key \ |
| 15 | + && apt-key add Release.key \ |
| 16 | + && apt-add-repository 'deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/ ./' \ |
| 17 | + && wget -nv https://dl.winehq.org/wine-builds/winehq.key \ |
| 18 | + && apt-key add winehq.key \ |
| 19 | + && add-apt-repository 'https://dl.winehq.org/wine-builds/ubuntu/' \ |
| 20 | + && apt-get update -qy \ |
| 21 | + && apt-get install --no-install-recommends -qfy winehq-$WINE_VERSION winbind cabextract \ |
| 22 | + && apt-get clean \ |
| 23 | + && wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \ |
| 24 | + && chmod +x winetricks \ |
| 25 | + && mv winetricks /usr/local/bin |
| 26 | + |
| 27 | +# wine settings |
| 28 | +ENV WINEARCH win64 |
| 29 | +ENV WINEDEBUG fixme-all |
| 30 | +ENV WINEPREFIX /wine |
| 31 | + |
| 32 | +# PYPI repository location |
| 33 | +ENV PYPI_URL=https://pypi.python.org/ |
| 34 | +# PYPI index location |
| 35 | +ENV PYPI_INDEX_URL=https://pypi.python.org/simple |
| 36 | + |
| 37 | +# install python in wine, using the msi packages to install, extracting |
| 38 | +# the files directly, since installing isn't running correctly. |
| 39 | +RUN set -x \ |
| 40 | + && winetricks win7 \ |
| 41 | + && for msifile in `echo core dev exe lib path pip tcltk tools`; do \ |
| 42 | + wget -nv "https://www.python.org/ftp/python/$PYTHON_VERSION/amd64/${msifile}.msi"; \ |
| 43 | + wine msiexec /i "${msifile}.msi" /qb TARGETDIR=C:/Python; \ |
| 44 | + rm ${msifile}.msi; \ |
| 45 | + done \ |
| 46 | + && cd /wine/drive_c/Python \ |
| 47 | + && echo 'wine '\''C:\Python\python.exe'\'' "$@"' > /usr/bin/python \ |
| 48 | + && echo 'wine '\''C:\Python\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \ |
| 49 | + && echo 'wine '\''C:\Python\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \ |
| 50 | + && echo 'wine '\''C:\Python\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \ |
| 51 | + && echo 'wine '\''C:\Python\Scripts\pyupdater.exe'\'' "$@"' > /usr/bin/pyupdater \ |
| 52 | + && echo 'assoc .py=PythonScript' | wine cmd \ |
| 53 | + && echo 'ftype PythonScript=c:\Python\python.exe "%1" %*' | wine cmd \ |
| 54 | + && while pgrep wineserver >/dev/null; do echo "Waiting for wineserver"; sleep 1; done \ |
| 55 | + && chmod +x /usr/bin/python /usr/bin/easy_install /usr/bin/pip /usr/bin/pyinstaller /usr/bin/pyupdater \ |
| 56 | + && (pip install -U pip || true) \ |
| 57 | + && rm -rf /tmp/.wine-* |
| 58 | + |
| 59 | +ENV W_DRIVE_C=/wine/drive_c |
| 60 | +ENV W_WINDIR_UNIX="$W_DRIVE_C/windows" |
| 61 | +ENV W_SYSTEM64_DLLS="$W_WINDIR_UNIX/system32" |
| 62 | +ENV W_TMP="$W_DRIVE_C/windows/temp/_$0" |
| 63 | + |
| 64 | +# install Microsoft Visual C++ Redistributable for Visual Studio 2017 dll files |
| 65 | +RUN set -x \ |
| 66 | + && rm -f "$W_TMP"/* \ |
| 67 | + && wget -P "$W_TMP" https://download.visualstudio.microsoft.com/download/pr/11100230/15ccb3f02745c7b206ad10373cbca89b/VC_redist.x64.exe \ |
| 68 | + && cabextract -q --directory="$W_TMP" "$W_TMP"/VC_redist.x64.exe \ |
| 69 | + && cabextract -q --directory="$W_TMP" "$W_TMP/a10" \ |
| 70 | + && cabextract -q --directory="$W_TMP" "$W_TMP/a11" \ |
| 71 | + && cd "$W_TMP" \ |
| 72 | + && rename 's/_/\-/g' *.dll \ |
| 73 | + && cp "$W_TMP"/*.dll "$W_SYSTEM64_DLLS"/ |
| 74 | + |
| 75 | +# install pyinstaller |
| 76 | +RUN /usr/bin/pip install pyinstaller==$PYINSTALLER_VERSION |
| 77 | + |
| 78 | +# put the src folder inside wine |
| 79 | +RUN mkdir /src/ && ln -s /src /wine/drive_c/src |
| 80 | +VOLUME /src/ |
| 81 | +WORKDIR /wine/drive_c/src/ |
| 82 | +RUN mkdir -p /wine/drive_c/tmp |
| 83 | + |
| 84 | +COPY entrypoint-windows.sh /entrypoint.sh |
| 85 | +RUN chmod +x /entrypoint.sh |
| 86 | + |
| 87 | +ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments