0

I am running windows binaries in a linux container using wine. For convenience, I create runnable shortcuts that invoke wine behind the scenes so my python code invoking these CLI tools works fine in Windows and Linux.

This is how my shortcut generation looks like:

for exe in /opt/tools/bin/*.exe; do
  tool="${exe##*/}"
  tool="${tool%.exe}"
  cat <<EOF > /opt/app/bin/${tool}
#!/bin/bash
wine /opt/tools/bin/${tool}.exe "\${@}"
EOF
  chmod 755 /opt/app/bin/${tool}
done

I tried to run this in a RUN command straight in the Dockerfile but that failed with some cryptic error, so I ended up just storing the script in a file that I copy into the image and then run.

COPY ./docker/shortcut_generator.sh ./
RUN ./shortcut_generator.sh

In a way, I have solved the issue, but I can't help but wonder if someone more knowledgeable on Dockerfile syntax than me could inline that snippet in the Dockerfile.

Fabio Picchi
  • 1,202
  • 2
  • 10
  • 22

0 Answers0