Skip to content

Instantly share code, notes, and snippets.

@astrolemonade
Created December 15, 2023 00:38
Show Gist options
  • Save astrolemonade/62e9cd5229e07cb6e9bcd4a125bd0f16 to your computer and use it in GitHub Desktop.
Save astrolemonade/62e9cd5229e07cb6e9bcd4a125bd0f16 to your computer and use it in GitHub Desktop.
Run QT5 gui app in Docker container
FROM ubuntu:bionic
RUN mkdir /app
COPY requirements.txt icons_rc.py main.py mainwindow_ui.py config.json /app/
RUN apt-get update && \
apt-get install -y python3 python3-pip xvfb libqt5x11extras5 && \
pip3 install -r /app/requirements.txt
docker run -it \
--user $(id -u) \
-e DISPLAY=unix$DISPLAY \
--workdir=/app \
--volume="/home/$USER:/home/$USER" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
someone/something:version \
python3 main.py --cfg config.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment