Dockerfile 960 B

12345678910111213141516171819202122232425
  1. # For more information, please refer to https://aka.ms/vscode-docker-python
  2. FROM python:3.12-slim
  3. EXPOSE 8000
  4. # Keeps Python from generating .pyc files in the container
  5. ENV PYTHONDONTWRITEBYTECODE=1
  6. # Turns off buffering for easier container logging
  7. ENV PYTHONUNBUFFERED=1
  8. RUN pip install poetry
  9. # Install pip requirements
  10. COPY requirements.txt .
  11. RUN python -m pip install -r requirements.txt
  12. WORKDIR /app
  13. COPY . /app
  14. # Creates a non-root user with an explicit UID and adds permission to access the /app folder
  15. # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
  16. RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
  17. USER appuser
  18. # During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
  19. CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "mapp:app"]