-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-anybodycon
335 lines (244 loc) · 12.7 KB
/
Dockerfile-anybodycon
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#syntax=docker/dockerfile:1.4
ARG ANYBODY_VERSION="8.0"
ARG ANYBODY_VERSION_PATCH="3"
ARG ANYBODY_BETA_SUFFIX=""
ARG ANYBODY_RC_SUFFIX=""
# ARG USERNAME=anybodyuser
# ARG BASE_IMAGE="debian"
# ARG DISTRO="debian"
# ARG DISTRO_VERSION="bullseye"
# ARG TAG="${DISTRO_VERSION}-20230411-slim"
# ARG WINEVERSION="4.0.4~${DISTRO_VERSION}"
ARG BASE_IMAGE="debian"
ARG DISTRO="debian"
ARG DISTRO_VERSION="bookworm"
ARG TAG="${DISTRO_VERSION}-20240211-slim"
ARG WINEVERSION="9.0.0.0~${DISTRO_VERSION}-1"
ARG USERNAME=anybodyuser
ARG GROUPNAME=anybodygroup
ARG USER_UID=1000
ARG USER_GID=1000
# ARG USERNAME=runner
# ARG GROUPNAME=docker
# ARG USER_UID=1001
# ARG USER_GID=121
# ARG BASE_IMAGE="mcr.microsoft.com/vscode/devcontainers/universal"
# ARG DISTRO="ubuntu"
# ARG DISTRO_VERSION="focal"
# ARG TAG="2.8.0-${DISTRO_VERSION}"
# ARG WINEVERSION="9.0.0.0~${DISTRO_VERSION}-1"
# ARG USERNAME=vscode
# ARG USER_UID=1000
# ARG USER_GID=1000
ARG WINECHANNEL="stable"
## Configure to use container build store which has the files from AnyBody
FROM ${BASE_IMAGE}:${TAG} AS anybody-build-store
ARG ANYBODY_VERSION
ARG ANYBODY_BETA_SUFFIX
ARG ANYBODY_RC_SUFFIX
ARG ANYBODY_VERSION_PATCH
ARG USERNAME
ARG GROUPNAME
#Fix issue on older debian images
RUN rm /etc/apt/sources.list.d/yarn.list || true
RUN apt-get update && apt-get install -y --no-install-recommends wget unzip ca-certificates
RUN wget -nc https://anybodycloudci.blob.core.windows.net/windows-anybodycon/anybody-minimal-${ANYBODY_VERSION}.${ANYBODY_VERSION_PATCH}${ANYBODY_BETA_SUFFIX}${ANYBODY_RC_SUFFIX}.zip
RUN unzip anybody-minimal-${ANYBODY_VERSION}.${ANYBODY_VERSION_PATCH}${ANYBODY_BETA_SUFFIX}${ANYBODY_RC_SUFFIX}.zip
RUN wget -nc https://anybodycloudci.blob.core.windows.net/windows-anybodycon/anybody-${ANYBODY_VERSION}-minimal-python.tar.gz
RUN tar -xzf anybody-${ANYBODY_VERSION}-minimal-python.tar.gz
# Run an intermediate docker step to get the Wine apt sources/keys, and build
# a dummy wine-stable-i386 package to shawdows the 32bit dependency.
FROM ${BASE_IMAGE}:${TAG} AS build-base
ARG BASE_IMAGE
ARG WINECHANNEL
ARG DISTRO
ARG DISTRO_VERSION
ARG WINEVERSION
ARG USERNAME
ARG GROUPNAME
ARG ANYBODY_VERSION
ARG ANYBODY_BETA_SUFFIX
ARG ANYBODY_RC_SUFFIX
ARG ANYBODY_VERSION_PATCH
SHELL ["/bin/bash", "-c"]
USER root
#Fix issue on older debian images
RUN rm /etc/apt/sources.list.d/yarn.list || true
# Get the necessary apt list and keys to install from winehq
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
gnupg software-properties-common equivs wget \
&& wget -nc https://dl.winehq.org/wine-builds/winehq.key \
&& mv winehq.key /usr/share/keyrings/winehq-archive.key \
&& mkdir -pm755 /etc/apt/keyrings \
&& cp /usr/share/keyrings/winehq-archive.key /etc/apt/keyrings/winehq-archive.key \
&& wget -nc https://dl.winehq.org/wine-builds/${DISTRO}/dists/${DISTRO_VERSION}/winehq-${DISTRO_VERSION}.sources \
&& mv winehq-${DISTRO_VERSION}.sources /etc/apt/sources.list.d/
COPY --chmod=0755 create-dummy-packages.sh /
RUN ./create-dummy-packages.sh wine-${WINECHANNEL}-i386 ${WINEVERSION}
# Only fake dependencies for debian
RUN if [[ $BASE_IMAGE != *"devcontainer"* ]]; then \
./create-dummy-packages.sh libsane1 libasound2 libasound2-plugins libasound2-data xkb-data \
libvpx7 shared-mime-info libnss3 libgstreamer-plugins-base1.0-0 libvorbis0a \
libtheora0 libjack-jackd2-0 libsamplerate0 liborc-0.4-0 libsnmp40 libharfbuzz0b \
libde265-0 libpixman-1-0 libmp3lame0 libpoppler-glib8 libsndfile1 libpango-1.0-0 \
libxvidcore4 libgstreamer1.0-0 ocl-icd-libopencl1 libheif1 libthai-data libzvbi0 \
libva2 libusb-1.0-0 libvorbisenc2 libwebp7 \
99:99; \
fi
FROM ${BASE_IMAGE}:${TAG} as big_image
SHELL ["/bin/bash", "-c"]
ARG WINEVERSION
ARG WINECHANNEL
ARG ANYBODY_VERSION
ARG ANYBODY_BETA_SUFFIX
ARG ANYBODY_RC_SUFFIX
ARG ANYBODY_VERSION_PATCH
ARG USERNAME
ARG GROUPNAME
ARG USER_UID
ARG USER_GID
# Change the default uid:gid to be easily compatible with github actions
USER root
#Fix issue on older debian images
RUN rm /etc/apt/sources.list.d/yarn.list || true
RUN apt update && apt install -y sudo curl tar
# Create the user with the UID and GID if they do not exist
RUN if [ ! $(getent group "${USER_GID}") ]; then \
groupadd -g "${USER_GID}" "${USERNAME}"; \
fi
RUN if [ ! $(getent passwd "${USER_UID}") ]; then \
useradd -u "${USER_UID}" -g "${USER_GID}" -m -s /bin/bash "${USERNAME}"; \
fi
# Rename the user/group if it already exists and has a different name
RUN usermod -l $USERNAME $(getent passwd $USER_UID | cut -d: -f1)
RUN groupmod -n $GROUPNAME $(getent group $USER_GID | cut -d: -f1)
# Move the home directory if it is not already in the correct location
RUN usermod "--login=${USERNAME}" "--home=/home/${USERNAME}" \
--move-home "-u ${USER_UID}" "${USERNAME}"
# Add user to sudoers
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ENV WINEPREFIX=/wine
COPY --from=build-base /*.deb /tmp/fake-wine-dependencies/
COPY --from=build-base /etc/apt/sources.list.d/ /etc/apt/sources.list.d/
COPY --from=build-base /etc/apt/keyrings/winehq-archive.key /etc/apt/keyrings/winehq-archive.key
COPY --from=build-base /usr/share/keyrings/winehq-archive.key /usr/share/keyrings/winehq-archive.key
RUN apt-get update \
&& apt-get install -y ca-certificates\
&& apt-get update \
&& dpkg -i /tmp/fake-wine-dependencies/*.deb \
&& apt-get install -y --no-install-recommends --no-install-suggests --no-upgrade wine-${WINECHANNEL}-amd64=${WINEVERSION}\
&& apt-get install -y --no-install-recommends --no-install-suggests --no-upgrade wine-${WINECHANNEL}=${WINEVERSION} \
&& ln /opt/wine-${WINECHANNEL}/bin/wine64 /opt/wine-${WINECHANNEL}/bin/wine \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV PATH="/opt/wine-${WINECHANNEL}/bin:${PATH}"
RUN mkdir -p /wine && chown -R $USER_UID:$USER_GID /wine && \
echo -e '#!/bin/bash\nwine $WINEPREFIX'"/drive_c/Program\ Files/AnyBody\ Technology/AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}/AnyBodyCon.exe \"\$@\"\n" > /usr/bin/anybodycon && \
chmod +x /usr/bin/anybodycon && chown -R $USER_UID:$USER_GID /usr/bin/anybodycon
USER ${USERNAME}
RUN WINEPREFIX=/wine winecfg
COPY --from=anybody-build-store --chown=${USER_UID} ["anybody" , "/wine/drive_c/Program Files/AnyBody Technology/AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}/"]
RUN /opt/wine-stable/bin/wine reg add HKCR\\AnyBody.any\\shell\\Open\\command /v "" /t REG_SZ /d "\"C:\Program Files\AnyBody Technology\AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}\AnyBody.exe\" \"%1\"" && \
sleep 5 && \
/opt/wine-stable/bin/wine reg add "HKLM\\SOFTWARE\\AnyBody Technology\\AnyBody.${ANYBODY_VERSION} (64-bit)${ANYBODY_BETA_SUFFIX/_/ }" /v "InstallDir" /t REG_SZ /d "C:\Program Files\AnyBody Technology\AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}" && \
sleep 5 && \
mkdir -p /wine/drive_c/users/${USERNAME}/My\ Documents && \
mkdir -p /wine/drive_c/users/${USERNAME}/AppData/Local/AnyBody\ Technology/AnyBody.${ANYBODY_VERSION}.x && \
mkdir -p /wine/drive_c/users/${USERNAME}/AppData/Roaming/AnyBody\ Technology/AnyBody.${ANYBODY_VERSION}.x && \
mkdir -p /wine/drive_c/users/${USERNAME}/Application\ Data/AnyBody\ Technology/AnyBody.${ANYBODY_VERSION}.x && \
mkdir -p /wine/drive_c/ProgramData/AnyBody\ Technology/AnyBody.${ANYBODY_VERSION}.x && \
mkdir -p /wine/drive_c/users/${USERNAME}/Local\ Settings/Application\ Data/AnyBody\ Technology/AnyBody.${ANYBODY_VERSION}.x
# Ensure that root can also use wine
USER root
RUN cp -R /wine/drive_c/users/${USERNAME} /wine/drive_c/users/root && \
chown -R root /wine/drive_c/users/root && \
mkdir /rootwine && \
ln -s /wine/dosdevices /rootwine/dosdevices && \
ln -s /wine/drive_c /rootwine/drive_c && \
cp /wine/system.reg /rootwine/system.reg && \
cp /wine/user.reg /rootwine/user.reg && \
chown root /rootwine/user.reg && \
chown root /rootwine/system.reg && \
WINEPREFIX=/rootwine winecfg && \
sed -i '2i export WINEPREFIX=/rootwine' /root/.profile && \
sed -i '2i export WINEPREFIX=/rootwine' /root/.bashrc
# DEV CONTAINER SETUP
COPY first-run-notice.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
RUN mkdir -p /usr/local/etc/vscode-dev-containers && \
mkdir -p "$HOME/.config/vscode-dev-containers" && \
touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed"
COPY first-run-notice.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
## SETUP PYTHON ANYBODY PYTHON ENVIRONMENT
COPY --from=anybody-build-store --chown=${USER_UID} ["Python" , "/wine/drive_c/Program Files/AnyBody Technology/AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}/Python"]
# Remove _pth file to allow overwriting PYTHON environment variables etc.
RUN rm -f /wine/drive_c/Program\ Files/AnyBody\ Technology/AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}/Python/python*._pth
# We explicitly set the WINEPATH 'activate' the AnyBody Python environment, instead of relying on the _pth file
ENV WINEPATH=C:\\Program\ Files\\AnyBody\ Technology\\AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}\\Python;C:\\Program\ Files\\AnyBody\ Technology\\AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}\\Python\\Library\\mingw-w64\\bin;C:\\Program\ Files\\AnyBody\ Technology\\AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}\\Python\\Library\\bin;C:\\Program\ Files\\AnyBody\ Technology\\AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}\\Python\\Scripts;c:\\windows\\system32;c:\\windows;c:\\windows\\system32\\wbem
ENV PYTHONHASHSEED=1234
USER root
# #INSTALL GIT
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-upgrade git \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV SystemRoot=c:\\windows
ENV SystemDrive=c:
USER ${USERNAME}
RUN curl -fsSL https://pixi.sh/install.sh | bash && \
echo 'export PATH="$PATH:$HOME/.pixi/bin"' >> ~/.bashrc
# # COPY --chown=${USER_UID} ["AnyBodyCon.exe" , "/wine/drive_c/Program Files/AnyBody Technology/AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}/AnyBodyCon.exe"]
# # COPY --chown=${USER_UID} ["AnyBodyCon-2024_02_16_05_07.map" , "/wine/drive_c/Program Files/AnyBody Technology/AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}/AnyBodyCon-2024_02_16_05_07.map"]
# # COPY --chown=${USER_UID} ["AnyBodyCon-2024_02_16_05_07.pdb" , "/wine/drive_c/Program Files/AnyBody Technology/AnyBody.${ANYBODY_VERSION}${ANYBODY_BETA_SUFFIX}/AnyBodyCon-2024_02_16_05_07.pdb"]
USER root
RUN find /opt/wine-stable -type f -name '*d3d*' -delete && \
find /opt/wine-stable -type f -name '*msvc?60*' -delete && \
find /opt/wine-stable -type f -name '*msvc?70*' -delete && \
find /opt/wine-stable -type f -name '*msvc?71*' -delete && \
find /opt/wine-stable -type f -name '*msvc?80*' -delete && \
find /opt/wine-stable -type f -name '*msvc?90*' -delete && \
find /opt/wine-stable -type f -name '*msvc?100*' -delete && \
find /opt/wine-stable -type f -name '*msvc?110*' -delete && \
find /opt/wine-stable -type f -name '*msvc?120*' -delete && \
find /opt/wine-stable -type f -name '*msvc?140*' -delete && \
find /opt/wine-stable -type f -name '*msvc?70*' -delete && \
find /opt/wine-stable -type f -name '*xaudio*' -delete
RUN rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/mshtml.dll && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/msxml3.dll && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/windowscodecs.dll && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/light.msstyles && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/msi.dll && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/ole32.dll && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/oleaut32.dll && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/winedbg.exe && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/jscript.dll && \
rm -rf /opt/wine-stable/lib64/wine/x86_64-windows/ieframe.dll
RUN if [[ ${USER_UID} == 1001 ]]; then \
mkdir -p /github && chown -R ${USER_UID}:${USER_GID} /github && \
ln -s /home/${ANYBODY_USER} /github/home; \
fi
USER ${USERNAME}
ENV RLM_LICENSE_PASSWORD=9h7KhWshjTpN
FROM scratch
SHELL ["/bin/bash", "-c"]
ARG WINEVERSION
ARG WINECHANNEL
ARG ANYBODY_VERSION
ARG ANYBODY_BETA_SUFFIX
ARG ANYBODY_RC_SUFFIX
ARG ANYBODY_VERSION_PATCH
ARG USERNAME
ARG GROUPNAME
ARG USER_UID
ARG USER_GID
# ENTRYPOINT ["/bin/bash"]
ENV PATH="/opt/wine-${WINECHANNEL}/bin:${PATH}"
ENV WINEDEBUG=-all
ENV RLM_LICENSE_PASSWORD=1234
ENV SystemRoot=c:\\windows
ENV SystemDrive=c:
ENV WINEPREFIX=/wine
COPY --from=big_image / /
USER ${USERNAME}