From f835edb1f5e29f1c9bdc158f6f284b5feaf93a5f Mon Sep 17 00:00:00 2001 From: McCloudS <64094529+McCloudS@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:53:39 -0700 Subject: [PATCH] Update Dockerfile --- Dockerfile | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 50be0f7..7bf2fe3 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,41 @@ +# Stage 1: Builder +FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 as builder + +WORKDIR /subgen + +# Install system dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + python3 \ + python3-pip \ + ffmpeg \ + git \ + && 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 -ADD https://raw.githubusercontent.com/McCloudS/subgen/main/requirements.txt /subgen/requirements.txt +# 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 -RUN apt-get update \ - && apt-get install -y \ - python3 \ - python3-pip \ - ffmpeg \ - git \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ - && pip3 install -r requirements.txt +# 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"]