# For more information, please refer to https://aka.ms/vscode-docker-python FROM python:3.9-slim # Keeps Python from generating .pyc files in the container ENV PYTHONDONTWRITEBYTECODE=1 # Turns off buffering for easier container logging ENV PYTHONUNBUFFERED=1 # Where we'll copy the code WORKDIR /code # Install pip requirements COPY requirements.txt /code/requirements.txt RUN python -m pip install --no-cache-dir --upgrade -r /code/requirements.txt # Creates a non-root user with an explicit UID and adds permission to access the /code folder # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers RUN useradd -m -u 1000 appuser && chown -R appuser /code USER appuser ENV HOME=/home/appuser ENV PATH=/home/appuser/.local/bin:$PATH WORKDIR $HOME/app COPY --chown=appuser . $HOME/app # During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]