fly.dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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"
  24. ADD . .
  25. # ensure unique version to not serve cached and hence potentially wrong static files
  26. ARG VERSION=unknown
  27. 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
  28. RUN sed -i "/\[tool.poetry\]/,/]/s/version = .*/version = \"$VERSION\"/" pyproject.toml
  29. RUN pip install .
  30. EXPOSE 8080
  31. EXPOSE 9062
  32. COPY fly-entrypoint.sh /entrypoint.sh
  33. ENTRYPOINT ["/entrypoint.sh"]
  34. ENV PYTHONUNBUFFERED=1
  35. CMD ["python", "main.py"]