fly.dockerfile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. FROM python:3.11-slim
  2. LABEL maintainer="Zauberzeug GmbH <nicegui@zauberzeug.com>"
  3. RUN apt update && apt install -y curl procps
  4. RUN pip install \
  5. dnspython \
  6. docutils \
  7. isort \
  8. itsdangerous \
  9. matplotlib \
  10. pandas \
  11. plotly \
  12. prometheus_client \
  13. pyecharts \
  14. pytest \
  15. requests \
  16. selenium
  17. RUN curl -sSL https://install.python-poetry.org | python3 - && \
  18. cd /usr/local/bin && \
  19. ln -s ~/.local/bin/poetry && \
  20. poetry config virtualenvs.create false
  21. WORKDIR /app
  22. COPY pyproject.toml poetry.lock* ./
  23. RUN poetry install --no-root --extras "plotly matplotlib highcharts sass"
  24. RUN pip install latex2mathml
  25. ADD . .
  26. # ensure unique version to not serve cached and hence potentially wrong static files
  27. ARG VERSION=unknown
  28. RUN if [ "$VERSION" = "unknown" ]; then echo "Error: VERSION build argument is required. Use: fly deploy --build-arg VERSION=$(git describe --abbrev=0 --tags --match 'v*' 2>/dev/null | sed 's/^v//' || echo '0.0.0')" && exit 1; fi
  29. RUN sed -i "/\[tool.poetry\]/,/]/s/version = .*/version = \"$VERSION\"/" pyproject.toml
  30. RUN pip install .
  31. EXPOSE 8080
  32. EXPOSE 9062
  33. COPY fly-entrypoint.sh /entrypoint.sh
  34. ENTRYPOINT ["/entrypoint.sh"]
  35. ENV PYTHONUNBUFFERED=1
  36. CMD ["python", "main.py"]