-
Notifications
You must be signed in to change notification settings - Fork 26
/
Dockerfile
114 lines (92 loc) · 3.86 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# syntax=docker/dockerfile:1.3
# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG FROM_IMAGE="rapidsai/ci-conda"
ARG CUDA_VER=12.5.1
ARG LINUX_DISTRO=ubuntu
ARG LINUX_VER=22.04
ARG PYTHON_VER=3.10
# ============= base ===================
FROM ${FROM_IMAGE}:cuda${CUDA_VER}-${LINUX_DISTRO}${LINUX_VER}-py${PYTHON_VER} AS base
ARG PROJ_NAME=mrc
ARG USERNAME=morpheus
ARG USER_UID=1000
ARG USER_GID=$USER_UID
SHELL ["/bin/bash", "-c"]
RUN --mount=type=cache,target=/var/cache/apt \
apt update &&\
apt install --no-install-recommends -y \
libnuma1 \
sudo && \
rm -rf /var/lib/apt/lists/*
# create a user inside the container
RUN useradd --uid $USER_UID --gid $USER_GID -m $USERNAME && \
usermod --shell /bin/bash $USERNAME && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME
COPY ./conda/environments/all_cuda-125_arch-x86_64.yaml /opt/mrc/conda/environments/all_cuda-125_arch-x86_64.yaml
RUN --mount=type=cache,target=/opt/conda/pkgs,sharing=locked \
echo "create env: ${PROJ_NAME}" && \
sudo -g conda -u $USERNAME \
CONDA_ALWAYS_YES=true \
/opt/conda/bin/mamba env create -q -n ${PROJ_NAME} --file /opt/mrc/conda/environments/all_cuda-125_arch-x86_64.yaml && \
chmod -R a+rwX /opt/conda && \
rm -rf /tmp/conda
RUN /opt/conda/bin/conda init --system &&\
sed -i 's/xterm-color)/xterm-color|*-256color)/g' ~/.bashrc &&\
echo "conda activate ${PROJ_NAME}" >> ~/.bashrc && \
cp /root/.bashrc /home/$USERNAME/.bashrc
# disable sscache wrappers around compilers
ENV CMAKE_CUDA_COMPILER_LAUNCHER=
ENV CMAKE_CXX_COMPILER_LAUNCHER=
ENV CMAKE_C_COMPILER_LAUNCHER=
# ============ build ==================
FROM base as build
# Add any build only dependencies here. For now there is none but we need the
# target to get the CI runner build scripts to work
# ============ test ==================
FROM base as test
# Add any test only dependencies here. For now there is none but we need the
# target to get the CI runner build scripts to work
# ========= development ================
FROM base as development
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update &&\
apt-get install --no-install-recommends -y \
gdb \
htop \
less \
openssh-client \
psmisc \
vim-tiny \
&& \
rm -rf /var/lib/apt/lists/*
# Install the .NET SDK. This is a workaround for https://github.com/dotnet/vscode-dotnet-runtime/issues/159
# Once version 1.6.1 of the extension has been release, this can be removed
RUN --mount=type=cache,target=/var/cache/apt \
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb &&\
sudo dpkg -i packages-microsoft-prod.deb &&\
rm packages-microsoft-prod.deb &&\
apt-get update && \
apt-get install --no-install-recommends -y dotnet-sdk-6.0 &&\
rm -rf /var/lib/apt/lists/*
USER $USERNAME
# default working directory
WORKDIR /work
# Setup git to allow other users to access /work. Requires git 2.35.3 or
# greater. See https://marc.info/?l=git&m=164989570902912&w=2. Only enable for
# development. Utilize --system to not interfere with VS Code
RUN git config --system --add safe.directory "*" && \
git config --system core.editor "vim"