sample1 / Dockerfile
sreepathi-ravikumar's picture
Update Dockerfile
c466556 verified
FROM python:3.11-slim
WORKDIR /app
# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc ffmpeg curl && \
rm -rf /var/lib/apt/lists/*
# Install pip before using it (fixes pip: not found error)
RUN python -m ensurepip --upgrade && pip install --no-cache-dir --upgrade pip
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create necessary folders with correct permissions
RUN mkdir -p /app/images /app/videos && chmod -R 777 /app/images /app/videos
# Copy application code
COPY app.py text2generation.py audio_scripter.py image_scripter.py image_fetcher.py video.py config.py ./
RUN apt-get update && apt-get install -y ffmpeg
RUN apt-get update && apt-get install -y fonts-liberation
# Expose the Flask port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Start the app
CMD ["python", "app.py"]