Skip to content

Instantly share code, notes, and snippets.

@Akashdesarda
Last active March 27, 2024 13:02
Show Gist options
  • Save Akashdesarda/f846297b68b80e641d34314010d2002b to your computer and use it in GitHub Desktop.
Save Akashdesarda/f846297b68b80e641d34314010d2002b to your computer and use it in GitHub Desktop.
FROM nvidia/cuda:10.1-cudnn7-runtime
RUN apt update && \
apt install --no-install-recommends -y build-essential software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt install --no-install-recommends -y python3.8 python3-pip python3-setuptools python3-distutils && \
apt clean && rm -rf /var/lib/apt/lists/*
COPY req.txt /req.txt
COPY ./src /src
RUN python3.8 -m pip install --upgrade pip && \
python3.8 -m pip install --no-cache-dir -r /req.txt
CMD ['python3', '/src/app.py']
EXPOSE 8080
@eldadcohen1
Copy link

eldadcohen1 commented Mar 27, 2024

`FROM nvidia/cuda:10.1-cudnn7-runtime

RUN apt update &&
apt install --no-install-recommends -y build-essential software-properties-common &&
add-apt-repository -y ppa:deadsnakes/ppa &&
apt install --no-install-recommends -y python3.8 python3-pip python3-setuptools python3-distutils &&
apt clean && rm -rf /var/lib/apt/lists/*

COPY req.txt /req.txt
RUN python3.8 -m pip install --upgrade pip &&
python3.8 -m pip install --no-cache-dir -r /req.txt

COPY ./src /src
CMD ['python3', '/src/app.py']
EXPOSE 8080`

This way is better because if the req.txt stays the same, the build command will not run the installation if there is no change in the req

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment