1
1

Dockerfile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ########################################
  2. # build webui #
  3. ########################################
  4. FROM node:14 AS builder
  5. # copy files
  6. COPY models/ /pycs/models/
  7. COPY labels/ /pycs/labels/
  8. COPY pycs/ /pycs/pycs/
  9. COPY webui/ /pycs/webui_dev/
  10. COPY app.py /pycs/
  11. COPY settings.json /pycs/
  12. # install packages
  13. RUN cd /pycs/webui_dev/ \
  14. && npm install
  15. # build webui
  16. RUN cd /pycs/webui_dev/ \
  17. && npm run build
  18. # move dist folder to webui
  19. RUN cd /pycs/ \
  20. && mv webui_dev/dist/ webui/ \
  21. && rm -rf webui_dev/
  22. ########################################
  23. # build pycs image #
  24. ########################################
  25. FROM python:3.9
  26. # copy from builder
  27. COPY --from=builder /pycs/ /pycs/
  28. # install required libraries for opencv
  29. RUN apt-get update \
  30. && apt-get install -y libgl1-mesa-glx ffmpeg libsm6 libxext6
  31. # create venv and install dependencies
  32. RUN cd /pycs/ \
  33. && python -m venv venv \
  34. && ./venv/bin/pip install numpy opencv-python Pillow scipy \
  35. && ./venv/bin/pip install eventlet flask python-socketio
  36. # configure start
  37. EXPOSE 5000
  38. WORKDIR /pycs/
  39. ENTRYPOINT ["./venv/bin/python", "app.py"]