Skip to content

Instantly share code, notes, and snippets.

@Moxnie
Created August 19, 2022 15:47
Show Gist options
  • Save Moxnie/c7a2388a57cf854f0a17469049ebc4b3 to your computer and use it in GitHub Desktop.
Save Moxnie/c7a2388a57cf854f0a17469049ebc4b3 to your computer and use it in GitHub Desktop.
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl
# get miniconda
# this yields strange warnings, but ultimately works
RUN curl -fsSL -v -o ~/miniconda.sh -O "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
# install miniconda
# install conda dependencies. Adjust as neccesary
RUN chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
/opt/conda/bin/conda install -y python=3.10 && \
/opt/conda/bin/conda install -y pytorch=1.11.0 torchvision=0.12.0 torchaudio=0.11.0 cudatoolkit=11.3 -c pytorch
ENV PATH /opt/conda/bin:$PATH
# -------------------------------------------------
RUN groupadd -r algorithm && useradd -m --no-log-init -r -g algorithm algorithm
RUN mkdir -p /opt/algorithm /input /output \
&& chown algorithm:algorithm /opt/algorithm /input /output
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ffmpeg libsm6 libxext6 --no-install-recommends
USER algorithm
WORKDIR /opt/algorithm
ENV PATH="/home/algorithm/.local/bin:${PATH}"
RUN python -m pip install --user -U pip
COPY --chown=algorithm:algorithm requirements.txt /opt/algorithm/
ADD --chown=algorithm:algorithm /EXAMPLE_DIR /EXAMPLE_DIR
RUN python -m pip install --user -r requirements.txt
COPY --chown=algorithm:algorithm process.py /opt/algorithm/
ENTRYPOINT python -m process $0 $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment