test multistage build

This commit is contained in:
Benedikt Wagener committed 2025-01-31 15:27:42 +01:00
1 parent c16746d1a4
commit 9a98c24b30
1 file changed
+21 -4
+21 -4
View File
@@ -1,12 +1,12 @@
FROM nvidia/cuda:12.6.3-runtime-ubuntu22.04
FROM nvidia/cuda:12.6.3-runtime-ubuntu22.04 AS base
# note: the python3-pip package contains Python 3.10 on Ubuntu 22.04
RUN apt-get update \
&& apt-get install git python3-pip python3.10-venv ffmpeg curl -y \
&& apt-get install git python3-pip python3.10-venv ffmpeg -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY ./requirements.txt /app/UltraSinger/requirements.txt
COPY . /app/UltraSinger
WORKDIR /app/UltraSinger
# no need to run as root
@@ -23,6 +23,23 @@ RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121 \
&& pip install --no-cache-dir tensorflow[and-cuda]==2.16.1
COPY . /app/UltraSinger
FROM nvidia/cuda:12.6.3-runtime-ubuntu22.04 AS runtime
# note: the python3-pip package contains Python 3.10 on Ubuntu 22.04
RUN apt-get update \
&& apt-get install git python3 ffmpeg -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN chown -R 1000:1000 /app/UltraSinger
USER 1000:1000
COPY --from=base /app/UltraSinger /app/UltraSinger
# setup venv
ENV VIRTUAL_ENV=/app/UltraSinger/.venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
WORKDIR /app/UltraSinger/src
CMD ["bash" ]