2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

kubeflow向けGPUが使えるcode-serverを立ち上げるの巻(ニッチ記事)

Posted at

はじめに

駆け出しインフラエンジニア用ハイパーマイナーな記事です。調べてもまとまって出てこない情報だったのでメモがてら残しておく。

docker file

  • 初めに、Dockerfileを出しておきます。
  • userだけkubeflowに合わせるのを忘れずにする。
  • ベースのdockerimageは環境に合わせましょう。
  • code-server.debはDocker build中にエラーを吐いてしまsったので、事前にダウンロードしておく。
FROM nvidia/cuda:11.4.2-cudnn8-devel-ubuntu20.04

ARG DOCKER_UID=1000
ARG DOCKER_GID=100
ARG DOCKER_USER=jovyan
ARG DOCKER_PASSWORD=jovyan
RUN useradd -m --uid ${DOCKER_UID} -g ${DOCKER_GID} --groups sudo ${DOCKER_USER} \
  && echo ${DOCKER_USER}:${DOCKER_PASSWORD} | chpasswd

RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        sudo \
        cmake \
        git \
        wget \
        libatlas-base-dev \
        libboost-all-dev \
        libgflags-dev \
        libgoogle-glog-dev \
        libhdf5-serial-dev \
        libleveldb-dev \
        liblmdb-dev \
        libprotobuf-dev \
        libsnappy-dev \
        protobuf-compiler \
        python3-dev \
        python3-pip \
        python3-setuptools \
        python3-tk \
        python3-matplotlib \
        less \
        aptitude \
        software-properties-common \
        ssh \
        unzip \
        qt5-default \
        qttools5-dev-tools \
        libqt5widgets5 \
        glew-utils \
        libglew-dev \
        libglm-dev \
        tcsh \
        aptitude \
        freeglut3-dev \
        libgl1-mesa-dev \
        libqt5opengl5-dev \
        libcanberra-gtk-dev \
        libcanberra-gtk-module \
        libgtest-dev \
        emacs \
        spyder \
        valgrind && \
    rm -rf /var/lib/apt/lists/*

# cmake
RUN pip3 install numpy==1.18.2
RUN pip3 install pillow==7.1.1 ipython==7.13.0 matplotlib==1.5.1

# for python profiling
RUN pip3 install line_profiler==3.0.2 && \
    pip3 install pyprof2calltree==1.4.4
RUN pip3 install scipy==1.4.1

RUN pip3 install --upgrade pip==20.0.2 setuptools==46.1.3

RUN pip3 install tensorflow-gpu==2.7.0
RUN pip3 install keras==2.7.0
RUN pip3 install opencv-python
RUN pip3 install opencv-contrib-python

RUN pip install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio===0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

RUN pip install pandas
RUN pip install tqdm

RUN pip install albumentations
RUN pip install sklearn
RUN pip install seaborn
RUN pip install tensorboard
RUN pip install hydra-core
RUN pip install tensorflow-model-optimization


# args - software versions
 # renovate: datasource=github-tags depName=cdr/code-server versioning=semver
ARG CODESERVER_VERSION=v4.6.1

# install - code-server
# CMD ["/bin/bash"]
# RUN /bin/bash curl -sL "https://github.com/cdr/code-server/releases/download/${CODESERVER_VERSION}/code-server_${CODESERVER_VERSION/v/}_amd64.deb" -o /tmp/code-server.deb  
COPY code-server_4.6.1_amd64.deb /tmp/code-server.deb
RUN dpkg -i /tmp/code-server.deb \
    && rm -f /tmp/code-server.deb

# # RUN wget https://github.com/cdr/code-server/releases/download/${CODESERVER_VERSION}/code-server_${CODESERVER_VERSION/v/}_amd64.deb -p /tmp/code-server.deb 

# RUN curl -fsSL https://code-server.dev/install.sh | sh && \
#     rm -rf "${HOME}/.cache"

# # install - codeserver extensions
ARG CODESERVER_GITLENS_VERSION=11.4.1
ARG CODESERVER_GIT_GRAPH_VERSION=1.30.0
RUN code-server --install-extension "ms-python.python" \
 && code-server --install-extension "ms-toolsai.jupyter" \    
 && code-server --install-extension "TabNine.tabnine-vscode" \    
 && code-server --install-extension "njpwerner.autodocstring" \ 
 && code-server --install-extension "eamodio.gitlens@${CODESERVER_GITLENS_VERSION}" \
 && code-server --install-extension "mhutchie.git-graph@${CODESERVER_GIT_GRAPH_VERSION}" 

USER ${DOCKER_USER}
EXPOSE 8888

ENV NB_PREFIX /
ENTRYPOINT ["/init"]

extensionの探し方

  1. vscodeのマーケットプレイスで検索する
  2. URLのitemName=以降をコピーする
    • ↓のコードブロックを参考。
  3. dockerfileに書き込む
https://marketplace.visualstudio.com/items?itemName=TabNine.tabnine-vscode
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?