Update Dockerfile

This commit is contained in:
McCloudS
2025-02-03 22:53:39 -07:00
committed by GitHub
parent 3764a91dd2
commit f835edb1f5

View File

@@ -1,23 +1,41 @@
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
# Stage 1: Builder
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 as builder
WORKDIR /subgen
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/requirements.txt /subgen/requirements.txt
RUN apt-get update \
&& apt-get install -y \
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
ffmpeg \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install -r requirements.txt
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Stage 2: Runtime
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
WORKDIR /subgen
# Copy necessary files from the builder stage
COPY --from=builder /subgen/requirements.txt .
COPY --from=builder /subgen/launcher.py .
COPY --from=builder /subgen/subgen.py .
COPY --from=builder /subgen/language_code.py .
COPY --from=builder /user/local /usr/local
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
ENV PYTHONUNBUFFERED=1
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/launcher.py /subgen/launcher.py
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/subgen.py /subgen/subgen.py
ADD https://raw.githubusercontent.com/McCloudS/subgen/main/language_code.py /subgen/language_code.py
CMD [ "bash", "-c", "python3 -u launcher.py" ]
# Set command to run the application
CMD ["python3", "launcher.py"]