College / Dockerfile
Alpha-xTeam
update
db1a6de
Raw
History Blame Contribute Delete
742 Bytes
FROM python:3.10
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Create work directory
WORKDIR /code
# Copy requirements and install
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Install a2wsgi and python-dotenv just in case
RUN pip install a2wsgi python-dotenv
# Copy the rest of the application
COPY . .
# Create a non-privileged user to run the app (Optional but recommended by HF)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
# Hugging Face Spaces expect the app to run on port 7860
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]