Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -14
Dockerfile
CHANGED
|
@@ -1,33 +1,31 @@
|
|
| 1 |
-
# Use a minimal Python image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install
|
| 8 |
RUN apt-get update && \
|
| 9 |
apt-get install -y --no-install-recommends gcc ffmpeg curl && \
|
| 10 |
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
RUN python -m pip install --upgrade pip
|
| 14 |
|
| 15 |
-
# Copy requirements and install
|
| 16 |
COPY requirements.txt .
|
| 17 |
-
RUN
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Copy application code
|
| 20 |
COPY app.py text2generation.py audio_scripter.py image_scripter.py image_fetcher.py video_creater.py ./
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
RUN mkdir -p /app/images && chmod -R 755 /app/images
|
| 24 |
-
|
| 25 |
-
# Expose the port your app runs on
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
-
#
|
| 29 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 30 |
-
|
| 31 |
|
| 32 |
-
# Start the
|
| 33 |
CMD ["python", "app.py"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install dependencies
|
| 6 |
RUN apt-get update && \
|
| 7 |
apt-get install -y --no-install-recommends gcc ffmpeg curl && \
|
| 8 |
rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Install pip before using it (fixes pip: not found error)
|
| 11 |
+
RUN python -m ensurepip --upgrade && pip install --no-cache-dir --upgrade pip
|
| 12 |
|
| 13 |
+
# Copy requirements and install
|
| 14 |
COPY requirements.txt .
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Create necessary folders with correct permissions
|
| 18 |
+
RUN mkdir -p /app/images /app/videos && chmod -R 777 /app/images /app/videos
|
| 19 |
|
| 20 |
# Copy application code
|
| 21 |
COPY app.py text2generation.py audio_scripter.py image_scripter.py image_fetcher.py video_creater.py ./
|
| 22 |
|
| 23 |
+
# Expose the Flask port
|
|
|
|
|
|
|
|
|
|
| 24 |
EXPOSE 7860
|
| 25 |
|
| 26 |
+
# Health check
|
| 27 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 28 |
+
CMD curl -f http://localhost:7860/health || exit 1
|
| 29 |
|
| 30 |
+
# Start the app
|
| 31 |
CMD ["python", "app.py"]
|