Spaces:
Running
Running
FROM python:3.9-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the dependencies file to the working directory | |
COPY requirements.txt . | |
# Install any needed packages specified in requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
# This command creates the credentials file from the secret we will set in the UI | |
# It ensures our app can authenticate with Google Cloud | |
RUN echo $GOOGLE_CREDENTIALS_JSON > /app/google_credentials.json | |
ENV GOOGLE_APPLICATION_CREDENTIALS=/app/google_credentials.json | |
# Copy the rest of the application code (app.py, templates/, etc.) | |
COPY . . | |
# Make port 7860 available to the world outside this container (Hugging Face standard) | |
EXPOSE 7860 | |
# Run the web server when the container launches | |
# Gunicorn is a robust server suitable for production | |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "app:app"] |