Dockerfile 1.0 KB

1234567891011121314151617181920212223242526272829
  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. RUN apt update && \
  10. apt install libgl1-mesa-glx ffmpeg libsm6 libxext6 -y
  11. # Install pip requirements
  12. COPY requirements.txt .
  13. RUN python -m pip install -r requirements.txt
  14. WORKDIR /app
  15. COPY . /app
  16. # Creates a non-root user with an explicit UID and adds permission to access the /app folder
  17. # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
  18. RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
  19. USER appuser
  20. # During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
  21. CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "mapp:app"]