-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (38 loc) · 1.34 KB
/
Dockerfile
File metadata and controls
51 lines (38 loc) · 1.34 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
48
49
50
51
# VidMod Backend Dockerfile
# Multi-stage build: compile in stage 1, run in stage 2 (smaller image, faster deploys)
# ============= BUILD STAGE =============
FROM python:3.11-slim AS builder
# Install build tools (only needed for compilation)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
g++ \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python packages to /root/.local (will copy to runtime stage)
COPY requirements.txt .
RUN pip install --upgrade pip && \
pip install --user -r requirements.txt
# ============= RUNTIME STAGE =============
FROM python:3.11-slim
# Install ONLY runtime dependencies (no gcc/g++, smaller image!)
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
WORKDIR /app
# Copy compiled packages from builder (no source code needed!)
COPY --from=builder /root/.local /root/.local
# Copy application code
COPY . .
# Create storage directories
RUN mkdir -p storage/uploads storage/frames storage/output
# Add local pip packages to PATH
ENV PATH=/root/.local/bin:$PATH
# Cloud Run uses port 8080 by default
EXPOSE 8080
# Run with uvicorn
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "2"]