Spaces:
Sleeping
Sleeping
File size: 1,055 Bytes
62206ca 6d68cb0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Use a lightweight Python base image
FROM python:3.10-slim
# Hugging Face Spaces require applications to run as a non-root user for security.
# We create a user named 'user' with User ID 1000.
RUN useradd -m -u 1000 user
# Switch to that new user
USER user
# Set environment variables for the user's home and path
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory inside the container
WORKDIR $HOME/app
# Copy the requirements file FIRST, and make sure the new user owns it
COPY --chown=user requirements.txt .
# Install all the Python libraries
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your application files (app.py and the weights file)
COPY --chown=user . .
# Expose the port Gradio will run on
EXPOSE 7860
# Force Gradio to broadcast on all network interfaces
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT="7860"
# Command to boot up the production engine
# Boot up the FastAPI server via Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |