-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_gpu
64 lines (50 loc) · 1.51 KB
/
Dockerfile_gpu
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
# Define the necessary arguments
ARG PYTHON_VERSION
ARG CUDA_TAG_IMAGE
# Step 1: Retrieve Python from an existing image
FROM python:${PYTHON_VERSION} as python-base
# Step 2: Build the final image
FROM nvidia/cuda:${CUDA_TAG_IMAGE}
# Copy Python from Step 1
COPY --from=python-base /usr/local /usr/local
# Install additional dependencies and configure the environment as needed
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl \
make \
nodejs \
npm \
git \
libopenblas-base \
&& rm -rf /var/lib/apt/lists/*
# Redefine the arguments that need to be retained
ARG PYTHON_VERSION
ARG DQ_LIB_VERSION
ARG POETRY_VERSION
# Set environment variables
ENV SHELL /bin/bash
ENV HOME /work
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV POETRY_VERSION=$POETRY_VERSION
ENV POETRY_CACHE $HOME/.cache/poetry
ENV POETRY_HOME /opt/.poetry
ENV PIP_CACHE_DIR $HOME/.cache/pip
ENV PATH $POETRY_HOME/bin:$PATH
ENV JUPYTER_RUNTIME_DIR /work/.cache/jupyter/runtime
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
# Set the working directory
WORKDIR $HOME
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y cuda-cupti-12-1 \
libgomp1 \
python3-tk \
g++ \
gcc \
graphviz \
bash-completion
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:${LD_LIBRARY_PATH}
ARG USER_ID
ARG GROUP_ID
# Create group and user
RUN groupadd -f -g ${GROUP_ID} john_dev_group && \
useradd -l -u ${USER_ID} -g john_dev_group john_dev_user