Dockerfile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. FROM python:3.12 as build-python
  2. ARG IS_CI
  3. ENV PYTHONUNBUFFERED=1 \
  4. PORT=8080 \
  5. POETRY_VIRTUALENVS_CREATE=false \
  6. POETRY_HOME=/opt/poetry \
  7. PIP_DISABLE_PIP_VERSION_CHECK=on
  8. WORKDIR /code
  9. RUN curl -sSL https://install.python-poetry.org | python3 -
  10. COPY poetry.lock pyproject.toml /code/
  11. RUN $POETRY_HOME/bin/poetry install --no-interaction --no-ansi $(test "$IS_CI" = "True" && echo "--no-dev")
  12. FROM python:3.12-slim
  13. ARG GLITCHTIP_VERSION=local
  14. ENV GLITCHTIP_VERSION ${GLITCHTIP_VERSION}
  15. ENV PYTHONUNBUFFERED=1 \
  16. PORT=8080
  17. RUN apt-get update && apt-get install -y libxml2 libpq5 && apt-get clean && rm -rf /var/lib/apt/lists/*
  18. WORKDIR /code
  19. COPY --from=build-python /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/
  20. COPY --from=build-python /usr/local/bin/ /usr/local/bin/
  21. EXPOSE 8080
  22. COPY . /code/
  23. ARG COLLECT_STATIC
  24. RUN if [ "$COLLECT_STATIC" != "" ] ; then SECRET_KEY=ci ./manage.py collectstatic --noinput; fi
  25. RUN useradd -u 5000 app && chown app:app /code && chown app:app /code/uploads
  26. USER app:app
  27. CMD ["./bin/start.sh"]