Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -16
Dockerfile
CHANGED
|
@@ -1,33 +1,24 @@
|
|
| 1 |
-
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Set environment variables
|
| 8 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 9 |
PYTHONUNBUFFERED=1 \
|
| 10 |
-
PORT=
|
| 11 |
|
| 12 |
-
# Install dependencies
|
| 13 |
COPY requirements.txt .
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
# Copy project files
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
-
#
|
| 20 |
RUN mkdir -p templates
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# Define health check
|
| 29 |
-
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
| 30 |
-
CMD curl -f http://localhost:8080/health || exit 1
|
| 31 |
-
|
| 32 |
-
# Run the application when the container launches
|
| 33 |
-
CMD ["python", "app.py"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# Set environment variables
|
| 6 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
PYTHONUNBUFFERED=1 \
|
| 8 |
+
PORT=7860
|
| 9 |
|
| 10 |
+
# Install dependencies
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
| 14 |
# Copy project files
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
+
# Ensure templates directory exists
|
| 18 |
RUN mkdir -p templates
|
| 19 |
|
| 20 |
+
# Expose the port Hugging Face Spaces expects
|
| 21 |
+
EXPOSE 7860
|
| 22 |
|
| 23 |
+
# Run the application with gunicorn for better performance
|
| 24 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|