Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +27 -0
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
+
|
| 3 |
+
# Install git and clean up in the same layer to keep the image size down
|
| 4 |
+
RUN apt-get update && \
|
| 5 |
+
apt-get install -y git && \
|
| 6 |
+
apt-get clean && \
|
| 7 |
+
rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# First copy only requirements to leverage Docker cache
|
| 12 |
+
COPY requirements.txt .
|
| 13 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
+
|
| 15 |
+
# Copy all application files
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# Set environment variables
|
| 19 |
+
ENV FLASK_APP=app.py
|
| 20 |
+
ENV FLASK_ENV=production
|
| 21 |
+
ENV PORT=7860
|
| 22 |
+
|
| 23 |
+
# Expose the port Hugging Face Spaces expects
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# Start the application
|
| 27 |
+
CMD ["python", "app.py"]
|