Add WiX Dockerfile and update image name (#2548)

Use a different base image and newer version of Wine to try to mitigate
crashes experienced by users in #2527.
This commit is contained in:
Zach Wasserman 2021-10-20 15:30:46 -07:00 committed by GitHub
parent 923d094471
commit 42c7933b22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 6 deletions

1
changes/fix-wix Normal file
View File

@ -0,0 +1 @@
* Improve MSI generation compatibility in `fleetctl package`.

View File

@ -21,9 +21,9 @@ const (
// https://wixtoolset.org/documentation/manual/v3/overview/heat.html.
func Heat(path string) error {
cmd := exec.Command(
"docker", "run", "--rm", "--platform", "linux/386",
"docker", "run", "--rm", "--platform", "linux/amd64",
"--volume", path+":/wix", // mount volume
"dactiv/wix:latest", // image name
"fleetdm/wix:latest", // image name
"heat", "dir", "root", // command in image
"-out", "heat.wxs",
"-gg", "-g1", // generate UUIDs (required by wix)
@ -47,9 +47,9 @@ func Heat(path string) error {
// https://wixtoolset.org/documentation/manual/v3/overview/candle.html.
func Candle(path string) error {
cmd := exec.Command(
"docker", "run", "--rm", "--platform", "linux/386",
"docker", "run", "--rm", "--platform", "linux/amd64",
"--volume", path+":/wix", // mount volume
"dactiv/wix:latest", // image name
"fleetdm/wix:latest", // image name
"candle", "heat.wxs", "main.wxs", // command in image
"-ext", "WixUtilExtension",
"-arch", "x64",
@ -69,9 +69,9 @@ func Candle(path string) error {
// https://wixtoolset.org/documentation/manual/v3/overview/light.html.
func Light(path string) error {
cmd := exec.Command(
"docker", "run", "--rm", "--platform", "linux/386",
"docker", "run", "--rm", "--platform", "linux/amd64",
"--volume", path+":/wix", // mount volume
"dactiv/wix:latest", // image name
"fleetdm/wix:latest", // image name
"light", "heat.wixobj", "main.wixobj", // command in image
"-ext", "WixUtilExtension",
"-b", "root", // Set directory for finding heat files

View File

@ -0,0 +1,62 @@
FROM debian:bullseye-slim
ARG wine_uid
ARG wine_gid
RUN true \
&& dpkg --add-architecture i386 \
&& apt update \
&& apt install -y --no-install-recommends \
ca-certificates \
wine \
wine32 \
wget \
unzip \
osslsigncode \
# Create a separate user for Wine
&& if [ -n "${wine_gid}" ] ; \
then addgroup --system wine -g ${wine_gid} ; \
else addgroup --system wine ; fi \
&& if [ -n "${wine_uid}" ] ; \
then \
adduser \
--home /home/wine \
--disabled-password \
--shell /bin/bash \
--gecos "non-root user for Wine" \
--ingroup wine \
--u ${wine_uid} \
wine ; \
else \
adduser \
--home /home/wine \
--disabled-password \
--shell /bin/bash \
--gecos "non-root user for Wine" \
--ingroup wine \
wine ;\
fi \
&& mkdir /wix \
&& chown wine:wine /wix \
&& rm -rf /var/lib/apt/lists/*
USER wine
WORKDIR /home/wine
ENV HOME=/home/wine WINEPREFIX=/home/wine/.wine WINEARCH=win32 PATH="/home/wine/bin:$PATH" WINEDEBUG=-all
COPY make-aliases.sh /home/wine/make-aliases.sh
# Install .NET framework and WiX Toolset binaries
RUN wine wineboot && \
wget https://dl.winehq.org/wine/wine-mono/6.4.0/wine-mono-6.4.0-x86.msi -nv -O mono.msi \
&& wine msiexec /i mono.msi \
&& rm -f mono.msi \
&& wget https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip -nv -O wix.zip \
&& mkdir wix \
&& unzip wix.zip -d wix \
&& rm -f wix.zip \
&& /home/wine/make-aliases.sh \
&& rm -f /home/wine/make-aliases.sh \
&& mkdir $WINEPREFIX/drive_c/temp
WORKDIR /wix

View File

@ -0,0 +1,18 @@
#!/bin/sh
# This script creates shell scripts that simulate adding all of the WiX binaries
# to the PATH. `wine /home/wine/wix/light.exe will be able to be called with
# just `light`.
mkdir -p /home/wine/bin
binpath=/home/wine/bin
for exe in $(ls /home/wine/wix | grep .exe$); do
name=$(echo $exe | cut -d '.' -f 1)
cat > $binpath/$name << EOF
#!/bin/sh
wine /home/wine/wix/$exe \$@
EOF
chmod +x $binpath/$name
done