Dockerfile 962 B

123456789101112131415161718192021222324252627
  1. # For more information, please refer to https://aka.ms/vscode-docker-python
  2. FROM python:3.12-slim
  3. # Keeps Python from generating .pyc files in the container
  4. ENV PYTHONDONTWRITEBYTECODE=1
  5. # Turns off buffering for easier container logging
  6. ENV PYTHONUNBUFFERED=1
  7. # Install pip requirements
  8. # COPY requirements.txt .
  9. # RUN python -m pip install -r requirements.txt
  10. COPY pyproject.toml .
  11. RUN python -m pip install "poetry==1.8.2"
  12. RUN poetry config virtualenvs.create false
  13. RUN poetry install
  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 ["python", "main.py"]