Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9-slim
|
2 |
+
|
3 |
+
# Set the working directory in the container
|
4 |
+
WORKDIR /app
|
5 |
+
|
6 |
+
# Copy the dependencies file to the working directory
|
7 |
+
COPY requirements.txt .
|
8 |
+
|
9 |
+
# Install any needed packages specified in requirements.txt
|
10 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
11 |
+
|
12 |
+
# This command creates the credentials file from the secret we will set in the UI
|
13 |
+
# It ensures our app can authenticate with Google Cloud
|
14 |
+
RUN echo $GOOGLE_CREDENTIALS_JSON > /app/google_credentials.json
|
15 |
+
ENV GOOGLE_APPLICATION_CREDENTIALS=/app/google_credentials.json
|
16 |
+
|
17 |
+
# Copy the rest of the application code (app.py, templates/, etc.)
|
18 |
+
COPY . .
|
19 |
+
|
20 |
+
# Make port 7860 available to the world outside this container (Hugging Face standard)
|
21 |
+
EXPOSE 7860
|
22 |
+
|
23 |
+
# Run the web server when the container launches
|
24 |
+
# Gunicorn is a robust server suitable for production
|
25 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "app:app"]
|