Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -5
Dockerfile
CHANGED
|
@@ -6,20 +6,28 @@ WORKDIR /app
|
|
| 6 |
|
| 7 |
# Set environment variables
|
| 8 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 9 |
-
PYTHONUNBUFFERED=1
|
|
|
|
| 10 |
|
| 11 |
-
# Install dependencies
|
| 12 |
COPY requirements.txt .
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
# Copy project files
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
#
|
| 19 |
RUN mkdir -p templates
|
| 20 |
|
| 21 |
-
#
|
|
|
|
|
|
|
|
|
|
| 22 |
EXPOSE 8080
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# Run the application when the container launches
|
| 25 |
-
CMD ["python", "app.py"]
|
|
|
|
| 6 |
|
| 7 |
# Set environment variables
|
| 8 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 9 |
+
PYTHONUNBUFFERED=1 \
|
| 10 |
+
PORT=8080
|
| 11 |
|
| 12 |
+
# Install dependencies first for better layer caching
|
| 13 |
COPY requirements.txt .
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
# Copy project files
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
+
# Make sure templates directory exists
|
| 20 |
RUN mkdir -p templates
|
| 21 |
|
| 22 |
+
# Create data directory if it doesn't exist
|
| 23 |
+
RUN mkdir -p /data && chmod 777 /data
|
| 24 |
+
|
| 25 |
+
# Make port 8080 available to the world outside this container
|
| 26 |
EXPOSE 8080
|
| 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"]
|