Dockerfile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. FROM python:3.13 AS build-python
  2. ARG IS_CI
  3. ENV PYTHONUNBUFFERED=1 \
  4. PORT=8080 \
  5. UV_COMPILE_BYTECODE=1 \
  6. UV_SYSTEM_PYTHON=true \
  7. UV_PYTHON_DOWNLOADS=never \
  8. UV_PROJECT_ENVIRONMENT=/usr/local \
  9. PIP_DISABLE_PIP_VERSION_CHECK=on
  10. WORKDIR /code
  11. COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
  12. COPY pyproject.toml uv.lock /code/
  13. RUN uv sync --frozen --no-install-project $(test "$IS_CI" = "True" && echo "--no-dev")
  14. FROM python:3.13-slim
  15. ARG GLITCHTIP_VERSION=local
  16. ENV GLITCHTIP_VERSION ${GLITCHTIP_VERSION}
  17. ENV PYTHONUNBUFFERED=1 \
  18. PORT=8080
  19. RUN apt-get update && apt-get install -y libxml2 libpq5 && apt-get clean && rm -rf /var/lib/apt/lists/*
  20. WORKDIR /code
  21. COPY --from=build-python /usr/local/lib/python3.13/site-packages/ /usr/local/lib/python3.13/site-packages/
  22. COPY --from=build-python /usr/local/bin/ /usr/local/bin/
  23. EXPOSE 8080
  24. COPY . /code/
  25. ARG COLLECT_STATIC
  26. RUN if [ "$COLLECT_STATIC" != "" ] ; then SECRET_KEY=ci ./manage.py collectstatic --noinput; fi
  27. RUN useradd -u 5000 app && chown app:app /code && chown app:app /code/uploads
  28. USER app:app
  29. CMD ["./bin/start.sh"]