Dockerfile 716 B

12345678910111213141516171819202122232425262728293031323334
  1. FROM python:3.8-slim-buster as builder
  2. WORKDIR /app
  3. ENV PYTHONDONTWRITEBYTECODE 1
  4. ENV PYTHONUNBUFFERED 1
  5. RUN apt-get update && \
  6. apt-get install -y --no-install-recommends build-essential
  7. COPY requirements.txt .
  8. RUN pip wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt
  9. FROM python:3.8-slim-buster
  10. WORKDIR /app
  11. COPY --from=builder /app/wheels /wheels
  12. COPY --from=builder /app/requirements.txt .
  13. ARG APP_USER=appuser
  14. RUN groupadd -r ${APP_USER} && useradd --no-log-init -r -g ${APP_USER} ${APP_USER}
  15. RUN pip install --no-cache /wheels/*
  16. COPY ./src /app
  17. USER ${APP_USER}:${APP_USER}
  18. CMD [ "uwsgi", "--http-socket", ":5000", "--plugin","python3", "--ini", "/app/uwsgi.ini" ]