Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight official Python image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory inside the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the requirements file first for layer caching
|
| 8 |
+
# This assumes your requirements.txt is in the root of the space
|
| 9 |
+
COPY requirements.txt .
|
| 10 |
+
|
| 11 |
+
# Install dependencies, including Gunicorn for serving the app
|
| 12 |
+
# The '--no-cache-dir' keeps the image size small
|
| 13 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
+
|
| 15 |
+
# Copy the rest of your application code and folders
|
| 16 |
+
# This includes app.py, services, routes, static, templates, etc.
|
| 17 |
+
COPY . .
|
| 18 |
+
|
| 19 |
+
# Hugging Face Spaces requires the app to listen on port 7860
|
| 20 |
+
EXPOSE 7860
|
| 21 |
+
|
| 22 |
+
# Command to run your application using Gunicorn (a production server)
|
| 23 |
+
# The format is 'app:app', where the first 'app' is your app.py file
|
| 24 |
+
# and the second 'app' is the variable name for your Flask/FastAPI instance (e.g., app = Flask(__name__)).
|
| 25 |
+
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]
|