fly.dockerfile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. FROM python:3.11.3-slim
  2. LABEL maintainer="Zauberzeug GmbH <nicegui@zauberzeug.com>"
  3. RUN apt update && apt install -y curl procps
  4. RUN pip install itsdangerous prometheus_client isort docutils pandas plotly pyecharts matplotlib requests dnspython
  5. RUN curl -sSL https://install.python-poetry.org | python3 - && \
  6. cd /usr/local/bin && \
  7. ln -s ~/.local/bin/poetry && \
  8. poetry config virtualenvs.create false
  9. WORKDIR /app
  10. COPY pyproject.toml poetry.lock* ./
  11. RUN poetry install --no-root --extras "plotly matplotlib highcharts"
  12. ADD . .
  13. # ensure unique version to not serve cached and hence potentially wrong static files
  14. ARG VERSION=unknown
  15. 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
  16. RUN sed -i "/\[tool.poetry\]/,/]/s/version = .*/version = \"$VERSION\"/" pyproject.toml
  17. RUN pip install .
  18. EXPOSE 8080
  19. EXPOSE 9062
  20. COPY fly-entrypoint.sh /entrypoint.sh
  21. ENTRYPOINT ["/entrypoint.sh"]
  22. ENV PYTHONUNBUFFERED=1
  23. CMD ["python", "main.py"]