open-numismat icon indicating copy to clipboard operation
open-numismat copied to clipboard

running within Docker

Open Maximus48p opened this issue 1 year ago • 3 comments

I would like to run this within Docker, but no idea how. Should be possible i suppose.

All help is very much appreciated.

Thanks.

Maximus48p avatar Sep 14 '23 09:09 Maximus48p

As a noob i've come pretty far. I created a dockerfile with the following content

# Use an official Python runtime as a parent image
FROM python:3.8-slim

# Install some tools
RUN apt-get update && \
    apt-get install -y wget unzip nano apt-utils && \
    apt-get clean

RUN apt-get install -y ffmpeg libsm6 libxext6 nodejs

# Set the working directory to /app
WORKDIR /app

# get source files open-numismat from github
RUN wget https://github.com/OpenNumismat/open-numismat/archive/refs/heads/master.zip
RUN unzip master.zip
WORKDIR /app/open-numismat-master

RUN pip install --upgrade pip
RUN pip install pyreadline3
RUN apt-get -y install libterm-readline-gnu-perl

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt

RUN apt-get install -y libqt5gui5 
# && \
#    rm -rf /var/lib/apt/lists/*
ENV QT_DEBUG_PLUGINS=1
RUN apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
RUN pip uninstall opencv-python
RUN pip install opencv-python-headless

# BUILD open-numismat
RUN apt-get -y install devscripts debhelper python3-setuptools dh-python
RUN debuild -uc -us

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable
ENV TZ=Europe/Amsterdam

# Run open-numismat.py when the container launches
#CMD ["python", "setup.py"]
CMD ["python", "open-numismat.py"]


# INSTRUCTIONS:
# CREATING IMAGE FROM DOCKERFILE, run from app-folder
# docker build -t open-numismat-app .

# CREATING CONTAINER FROM DOCKERFILE, run from app-folder
# docker run -d -p 8052:80 open-numismat-app

When starting the container with: docker run -d -p 8052:80 open-numismat-app i'm getting the following error:

Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/bin/platforms" ...
loaded library "/usr/local/lib/python3.8/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Any help is very much appreciated....

Maximus48p avatar Sep 15 '23 10:09 Maximus48p

@Maximus48p, please check the following https://stackoverflow.com/questions/65642916/running-a-qt-gui-in-a-docker-container

Also, you don't need port forwarding

JanisV avatar Sep 18 '23 15:09 JanisV

@Maximus48p Did you ever get this to run? While this is quite novel aproach to running app I was more thinking about only just having build in docker, since my local build after its done doesn't seem to work (while I am professional java developer, I never tried my hand at this and it seems that my local dependencies are somehow messed up, so produced .deb doesn't really work)...

andyrozman avatar Mar 28 '24 09:03 andyrozman