Repository navigation
Expand file tree
/
Copy pathDockerfile.backend
More file actions
48 lines (36 loc) · 1.53 KB
/
Copy pathDockerfile.backend
File metadata and controls
48 lines (36 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# =====================================================================
# VidSnap AI — Production Backend Dockerfile
# FastAPI + FFmpeg + Voice Synthesis + Persistent Volume Mounts
# =====================================================================
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/app/backend \
DATA_DIR=/app/data \
MEDIA_DIR=/app/data/media
# Install native dependencies: FFmpeg, FFprobe, and TrueType fonts for ASS subtitles
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
fonts-dejavu-core \
fonts-liberation \
curl \
espeak-ng \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies
COPY backend/requirements.txt /app/backend/
RUN pip install --no-cache-dir -r /app/backend/requirements.txt
# Copy backend source code
COPY backend /app/backend/
# Copy default templates and background audio for volume seeding
COPY media/templates /app/default_media/templates/
COPY media/songs /app/default_media/songs/
# Create single persistent storage mount directory
RUN mkdir -p /app/data/media
# Expose backend port
EXPOSE 8000
# Container healthcheck using VidSnap's /api/health endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:${PORT:-8000}/api/health || exit 1
# Start FastAPI with uvicorn (respecting Railway's dynamic $PORT with 8000 default)
CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8000} --workers 2"]