Created
June 1, 2022 14:54
-
-
Save atinfinity/f559aa72ffae84acea4f88058457ff4b to your computer and use it in GitHub Desktop.
OnnxGraphQt_Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 | |
ARG GID=1000 | |
ARG UID=1000 | |
# add new sudo user | |
ENV USERNAME onnx | |
ENV HOME /home/$USERNAME | |
RUN groupadd -f -g ${GID} ${USERNAME} | |
RUN useradd -m $USERNAME -u ${UID} -g ${GID} && \ | |
echo "$USERNAME:$USERNAME" | chpasswd && \ | |
usermod --shell /bin/bash $USERNAME && \ | |
usermod -aG sudo $USERNAME && \ | |
mkdir /etc/sudoers.d && \ | |
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \ | |
chmod 0440 /etc/sudoers.d/$USERNAME | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
sudo \ | |
less \ | |
emacs \ | |
tmux \ | |
bash-completion \ | |
command-not-found \ | |
software-properties-common \ | |
xsel \ | |
xdg-user-dirs \ | |
git \ | |
libpulse-mainloop-glib0 \ | |
python3-pip \ | |
python3-pyqt5 \ | |
&& \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* | |
USER $USERNAME | |
WORKDIR /home/$USERNAME | |
SHELL ["/bin/bash", "-c"] | |
RUN python3 -m pip install nvidia-pyindex | |
RUN python3 -m pip install onnx-graphsurgeon | |
RUN python3 -m pip install protobuf==3.20.1 | |
RUN python3 -m pip install onnx-simplifier | |
RUN python3 -m pip install Qt.py | |
RUN git clone https://github.com/fateshelled/OnnxGraphQt.git && \ | |
cd OnnxGraphQt && \ | |
python3 -m pip install -U -r requirements.txt | |
# Set PATH | |
RUN echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
XSOCK=/tmp/.X11-unix | |
XAUTH=/tmp/.docker.xauth | |
touch $XAUTH | |
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - | |
docker run --rm -it \ | |
--volume=$XSOCK:$XSOCK:rw \ | |
--volume=$XAUTH:$XAUTH:rw \ | |
--volume=$HOME:$HOME \ | |
--shm-size=1gb \ | |
--env="XAUTHORITY=${XAUTH}" \ | |
--env="DISPLAY=${DISPLAY}" \ | |
--env=TERM=xterm-256color \ | |
--env=QT_X11_NO_MITSHM=1 \ | |
onnxgraphqt:latest \ | |
bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build docker image
Launch docker container
Use OnnxGraphQt in docker container
cd OnnxGraphQt python3 onnxgraphqt/main.py onnxgraphqt/data/mobilenetv2-7.onnx