Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use nemo docker container as base image #11824

Open
famda opened this issue Jan 11, 2025 · 2 comments
Open

How to use nemo docker container as base image #11824

famda opened this issue Jan 11, 2025 · 2 comments

Comments

@famda
Copy link

famda commented Jan 11, 2025

Hi,
I'm trying to create a docker image that uses nemo as the base image.
I have a python project with some scripts (including a requirements.txt file with some additional dependencies) that I'm containerizing on that same image.

The Nemo base image is around 29GB in size but when I run pip install on the requirements file the output is around 100GB because it reinstalls everything and it takes ages to complete.

I'm trying to learn how to use this and make some cool examples with ASR and TTS for research/personal training.

I'm pretty sure I'm doing something wrong on this dependency hell. 😀

It would be nice to have a simple dockerfile that uses nvidia/nemo as base image and a simple python project in it.

Can someone help, please?

Thanks in advance.

@wheynelau
Copy link

Hi, you can use this as the start of your dockerfile

ARG NEMOFW_VERSION=24.09
FROM nvcr.io/nvidia/nemo:$NEMOFW_VERSION

@famda
Copy link
Author

famda commented Jan 13, 2025

@wheynelau thanks for your reply.
That is what I'm doing. Here is my dockerfile:

FROM nvcr.io/nvidia/nemo:24.12 AS base
EXPOSE 8080

# Install PowerShell Core
RUN apt-get update && apt-get install -y wget \
    && wget -q https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb \
    && dpkg -i packages-microsoft-prod.deb \
    && apt-get update \
    && apt-get install -y powershell \
    && rm packages-microsoft-prod.deb \
    && rm -rf /var/lib/apt/lists/*

# Install PowerShell Core
RUN apt-get update && apt-get install -y wget \
    && wget -q https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb \
    && dpkg -i packages-microsoft-prod.deb \
    && apt-get update \
    && apt-get install -y powershell \
    && rm packages-microsoft-prod.deb \
    && rm -rf /var/lib/apt/lists/*

# Install dependencies aspnetcore
RUN apt-get update && apt-get install -y \
    apt-transport-https \
    software-properties-common

# Download and run the Microsoft installation script
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
    && chmod +x dotnet-install.sh \
    && ./dotnet-install.sh --runtime aspnetcore --version 9.0.0

# Set the environment variables 
ENV DOTNET_ROOT=/root/.dotnet 
ENV PATH=$PATH:/root/.dotnet

WORKDIR /app
COPY ../Diarization/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY ../Diarization/audio ./audio

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Worker/Worker.csproj", "Worker/"]
RUN dotnet restore "./Worker/Worker.csproj"
COPY . .
WORKDIR "/src/Worker"
RUN dotnet build "./Worker.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Worker.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Worker.dll"]

And here is my requirements.txt file:

faster-whisper
pydub
demucs
soundfile
Cython
packaging

This image has 97.35GB and this is the issue. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants