-
-
Notifications
You must be signed in to change notification settings - Fork 81
/
Dockerfile.wine
118 lines (91 loc) · 4.29 KB
/
Dockerfile.wine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Adapted from https://github.com/cdrx/docker-pyinstaller/blob/master/Dockerfile-py3-win64
FROM python:3.11.6-slim-bookworm as base
ENV DEBIAN_FRONTEND noninteractive
ARG WINE_VERSION=winehq-stable
ARG PYTHON_VERSION=3.11.6
ARG PYINSTALLER_VERSION=5.13.2
# we need wine for this all to work, so we'll use the PPA
RUN set -x \
&& dpkg --add-architecture i386 \
&& apt-get update -qy \
&& apt-get install --no-install-recommends -qfy apt-transport-https software-properties-common wget \
# && wget -nv https://dl.winehq.org/wine-builds/winehq.key \
&& mkdir -pm755 /etc/apt/keyrings \
&& wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key \
# && apt-key add winehq.key \
&& add-apt-repository 'https://dl.winehq.org/wine-builds/debian/' \
&& wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources \
&& apt-get update -qy \
&& apt-get install --no-install-recommends -qfy $WINE_VERSION winbind cabextract rename \
&& apt-get clean \
&& wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \
&& chmod +x winetricks \
&& mv winetricks /usr/local/bin
# wine settings
ENV WINEARCH win64
ENV WINEDEBUG fixme-all
ENV WINEPREFIX /wine
# PYPI repository location
ENV PYPI_URL=https://pypi.python.org/
# PYPI index location
ENV PYPI_INDEX_URL=https://pypi.python.org/simple
# install python in wine, using the msi packages to install, extracting
# the files directly, since installing isn't running correctly.
RUN set -x \
&& winetricks win11 \
&& for msifile in `echo core dev exe lib path pip tcltk tools`; do \
wget -nv "https://www.python.org/ftp/python/$PYTHON_VERSION/amd64/${msifile}.msi"; \
wine msiexec /i "${msifile}.msi" /qb TARGETDIR=C:/Python311; \
rm ${msifile}.msi; \
done \
&& cd /wine/drive_c/Python311 \
&& echo 'wine '\''C:\Python311\python.exe'\'' "$@"' > /usr/bin/python \
&& echo 'wine '\''C:\Python311\Scripts\easy_install.exe'\'' "$@"' > /usr/bin/easy_install \
&& echo 'wine '\''C:\Python311\Scripts\pip.exe'\'' "$@"' > /usr/bin/pip \
&& echo 'wine '\''C:\Python311\Scripts\pyinstaller.exe'\'' "$@"' > /usr/bin/pyinstaller \
&& echo 'wine '\''C:\Python311\Scripts\pyupdater.exe'\'' "$@"' > /usr/bin/pyupdater \
&& echo 'assoc .py=PythonScript' | wine cmd \
&& echo 'ftype PythonScript=c:\Python311\python.exe "%1" %*' | wine cmd \
&& while pgrep wineserver >/dev/null; do echo "Waiting for wineserver"; sleep 1; done \
&& chmod +x /usr/bin/python /usr/bin/easy_install /usr/bin/pip /usr/bin/pyinstaller /usr/bin/pyupdater \
&& (pip install -U pip || true) \
&& rm -rf /tmp/.wine-*
ENV W_DRIVE_C=/wine/drive_c
ENV W_WINDIR_UNIX="$W_DRIVE_C/windows"
ENV W_SYSTEM64_DLLS="$W_WINDIR_UNIX/system32"
ENV W_TMP="$W_DRIVE_C/windows/temp/_$0"
RUN set -x \
&& rm -f "$W_TMP"/* \
&& wget -P "$W_TMP" https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe \
# && wget -P "$W_TMP" https://aka.ms/vs/17/release/vc_redist.x64.exe \
&& cabextract -q --directory="$W_TMP" "$W_TMP"/vc_redist.x64.exe \
&& cabextract -q --directory="$W_TMP" "$W_TMP/a10" \
&& cabextract -q --directory="$W_TMP" "$W_TMP/a11" \
&& cd "$W_TMP" \
&& rename 's/_/\-/g' *.dll \
&& cp "$W_TMP"/*.dll "$W_SYSTEM64_DLLS"/
# install pyinstaller
RUN /usr/bin/pip install pyinstaller==$PYINSTALLER_VERSION
FROM base as final
RUN mkdir /src/
WORKDIR /src/
# Install build dependencies, install dependencies, remove build dependencies
RUN apt update && \
apt upgrade -y && \
apt-get install git libpq-dev build-essential -y
COPY backend/pyproject.toml ./
RUN pip install --no-cache-dir poetry && \
poetry self add poetry-plugin-export && \
poetry export --without-hashes -f requirements.txt --output requirements.txt
# Install pip packages during build instead of run
RUN wine C:/Python311/python.exe -m pip install -r requirements.txt
COPY images/logo.ico .
COPY backend/*.py .
COPY backend/dataline ./dataline
COPY backend/alembic ./alembic
COPY backend/alembic.ini .
COPY backend/assets ./assets
COPY backend/templates ./templates
COPY entrypoint-wine.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]