Dockerfile 951 B

1234567891011121314151617181920212223242526272829303132333435
  1. FROM python:3.11 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. COPY requirements.txt /code/
  10. RUN pip install --no-cache-dir -r requirements.txt
  11. FROM python:3.11-slim
  12. ARG GLITCHTIP_VERSION=local
  13. ENV GLITCHTIP_VERSION ${GLITCHTIP_VERSION}
  14. ENV PYTHONUNBUFFERED=1 \
  15. PORT=8080
  16. RUN apt-get update && apt-get install -y libxml2 libpq5 && apt-get clean && rm -rf /var/lib/apt/lists/*
  17. WORKDIR /code
  18. COPY --from=build-python /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
  19. COPY --from=build-python /usr/local/bin/ /usr/local/bin/
  20. EXPOSE 8080
  21. COPY . /code/
  22. ARG COLLECT_STATIC
  23. RUN if [ "$COLLECT_STATIC" != "" ] ; then SECRET_KEY=ci ./manage.py collectstatic --noinput; fi
  24. RUN useradd -u 5000 app && chown app:app /code && chown app:app /code/uploads
  25. USER app:app
  26. CMD ["./bin/start.sh"]