Skip to content
Snippets Groups Projects
Dockerfile 1.7 KiB
Newer Older
Xuefeng Ding's avatar
Xuefeng Ding committed
# Use AlmaLinux 9 base image
FROM almalinux:9
LABEL user.name="vscode"

# https://apt.llvm.org/
RUN dnf --best --assumeyes update && \
    dnf -y install \
        python3.11 python3.11-pip \
        gcc make cmake \
        git \
        zsh \
        which util-linux-user wget sudo passwd \
        clang lldb lld clang-tools-extra && \
    dnf clean all

RUN rm /usr/bin/cc /usr/bin/c++ && \
    alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && \
    alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 && \
    alternatives --auto c++ && \
    alternatives --auto cc

RUN dnf -y install 'dnf-command(config-manager)' && \
    dnf -y config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo && \
    dnf -y install cuda-nvcc-12-4 && \
    dnf clean all

RUN useradd -ms /bin/zsh vscode && \
    usermod -aG wheel vscode
Xuefeng Ding's avatar
Xuefeng Ding committed

WORKDIR /workspaces
USER vscode

RUN python3.11 -m venv /workspaces/venv
Xuefeng Ding's avatar
Xuefeng Ding committed

COPY requirements.txt /workspaces/requirements.txt
COPY requirements-dev.txt /workspaces/requirements-dev.txt

RUN sh -c "$(curl -fsSL https://install.ohmyz.sh/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

RUN echo 'export PATH="/usr/local/cuda-12.4/bin${PATH:+:${PATH}}"' >>~/.zshrc && \
    echo 'export LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"' >>~/.zshrc && \
    source /workspaces/venv/bin/activate && \
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
    pip install --upgrade pip && \
    pip install -r requirements-dev.txt && \
    rm -rf /workspaces/requirements.txt /workspaces/requirements-dev.txt && \
    echo "hi"
    # sudo chown vscode:vscode -R /workspaces