Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +45 -0
Dockerfile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Stage 1: Builder
|
| 2 |
+
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 AS builder
|
| 3 |
+
|
| 4 |
+
WORKDIR /subgen
|
| 5 |
+
|
| 6 |
+
ARG DEBIAN_FRONTEND=noninteractive
|
| 7 |
+
|
| 8 |
+
# Install system dependencies
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
python3 \
|
| 11 |
+
python3-pip \
|
| 12 |
+
ffmpeg \
|
| 13 |
+
git \
|
| 14 |
+
tzdata \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
+
|
| 17 |
+
# Copy requirements and install Python dependencies
|
| 18 |
+
COPY requirements.txt .
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# Copy application code
|
| 22 |
+
COPY . .
|
| 23 |
+
|
| 24 |
+
# Stage 2: Runtime
|
| 25 |
+
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
|
| 26 |
+
|
| 27 |
+
WORKDIR /subgen
|
| 28 |
+
|
| 29 |
+
# Copy necessary files from the builder stage
|
| 30 |
+
COPY --from=builder /subgen/launcher.py .
|
| 31 |
+
COPY --from=builder /subgen/subgen.py .
|
| 32 |
+
COPY --from=builder /subgen/language_code.py .
|
| 33 |
+
COPY --from=builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
|
| 34 |
+
|
| 35 |
+
# Install runtime dependencies
|
| 36 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 37 |
+
ffmpeg \
|
| 38 |
+
python3 \
|
| 39 |
+
curl \
|
| 40 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 41 |
+
|
| 42 |
+
ENV PYTHONUNBUFFERED=1
|
| 43 |
+
|
| 44 |
+
# Set command to run the application
|
| 45 |
+
CMD ["python3", "launcher.py"]
|