Dockerfile 779 B

12345678910111213141516171819202122232425262728293031
  1. FROM python:3.10 as build-python
  2. ARG IS_CI
  3. ENV PYTHONUNBUFFERED=1 \
  4. PORT=8080 \
  5. POETRY_VIRTUALENVS_CREATE=false \
  6. PIP_DISABLE_PIP_VERSION_CHECK=on
  7. RUN pip install poetry
  8. WORKDIR /code
  9. COPY poetry.lock pyproject.toml /code/
  10. RUN poetry install --no-interaction --no-ansi $(test "$IS_CI" = "True" && echo "--no-dev")
  11. FROM python:3.10-slim
  12. ENV PYTHONUNBUFFERED=1 \
  13. PORT=8080
  14. RUN apt-get update && apt-get install -y libxml2 libpq5 && apt-get clean && rm -rf /var/lib/apt/lists/*
  15. WORKDIR /code
  16. COPY --from=build-python /usr/local/lib/python3.10/site-packages/ /usr/local/lib/python3.10/site-packages/
  17. COPY --from=build-python /usr/local/bin/ /usr/local/bin/
  18. EXPOSE 8080
  19. COPY . /code/
  20. RUN useradd -u 5000 app && chown app:app /code
  21. USER app:app
  22. CMD ["./bin/start.sh"]