6
0

Dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ########################################
  2. # build webui #
  3. ########################################
  4. FROM node:14 AS builder
  5. # copy files
  6. COPY webui/ /pycs/webui_dev/
  7. WORKDIR /pycs/webui_dev
  8. # install packages
  9. RUN npx browserslist@latest --update-db
  10. RUN npm install
  11. # build webui
  12. RUN npm run build
  13. ########################################
  14. # build pycs image #
  15. ########################################
  16. FROM python:3.9 AS pycs
  17. # get the user and group. if not defined, fallback to root
  18. ARG UID=root
  19. ARG GID=root
  20. # copy backend files
  21. COPY pycs/ /pycs/pycs/
  22. COPY migrations/ /pycs/migrations/
  23. COPY app.py /pycs/
  24. COPY requirements.txt /pycs/
  25. WORKDIR /pycs/
  26. RUN mkdir projects db
  27. RUN chown ${UID}:${GID} projects db
  28. # copy UI from builder
  29. COPY --from=builder /pycs/webui_dev/dist /pycs/webui
  30. # install required libraries for opencv
  31. RUN apt-get update \
  32. && apt-get install -y libgl1-mesa-glx ffmpeg libsm6 libxext6
  33. # install dependencies
  34. RUN python -m pip install --upgrade pip
  35. RUN pip install numpy
  36. RUN pip install -r /pycs/requirements.txt
  37. # configure start
  38. USER ${UID}:${GID}
  39. EXPOSE 5000
  40. #ENTRYPOINT ["python", "app.py"]