######################################## # build webui # ######################################## FROM node:14 AS builder # copy files COPY models/ /pycs/models/ COPY labels/ /pycs/labels/ COPY pycs/ /pycs/pycs/ COPY webui/ /pycs/webui_dev/ COPY app.py /pycs/ COPY settings.json /pycs/ # install packages RUN cd /pycs/webui_dev/ \ && npm install # build webui RUN cd /pycs/webui_dev/ \ && npm run build # move dist folder to webui RUN cd /pycs/ \ && mv webui_dev/dist/ webui/ \ && rm -rf webui_dev/ ######################################## # build pycs image # ######################################## FROM python:3.9 # copy from builder COPY --from=builder /pycs/ /pycs/ # install required libraries for opencv RUN apt-get update \ && apt-get install -y libgl1-mesa-glx ffmpeg libsm6 libxext6 # create venv and install dependencies RUN cd /pycs/ \ && python -m venv venv \ && ./venv/bin/pip install numpy opencv-python Pillow scipy \ && ./venv/bin/pip install eventlet flask python-socketio # configure start EXPOSE 5000 WORKDIR /pycs/ ENTRYPOINT ["./venv/bin/python", "app.py"]