-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (56 loc) · 1.73 KB
/
Dockerfile
File metadata and controls
71 lines (56 loc) · 1.73 KB
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
FROM nvidia/cuda:12.4.0-runtime-ubuntu22.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV NVIDIA_DISABLE_REQUIRE=true
# Install basic development tools and dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
ca-certificates \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
wget \
llvm \
libncurses5-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libffi-dev \
liblzma-dev \
libgdbm-dev \
libnss3-dev \
python3-tk \
python3-pip && \
rm -rf /var/lib/apt/lists/*
# Install Python 3.11 from source
RUN cd /usr/src && \
wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz && \
tar -xzf Python-3.11.0.tgz && \
cd Python-3.11.0 && \
./configure --enable-optimizations --with-ssl && \
make altinstall
# Set Python 3.11 as the default Python version
RUN update-alternatives --install /usr/bin/python python /usr/local/bin/python3.11 1
# Upgrade pip
RUN python -m pip install --upgrade pip==23.2.1
# Set the working directory
WORKDIR /app
# Copy only requirements.txt to leverage Docker cache
COPY requirements.txt /app/requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Stage 2: Application build
FROM base AS build
# Set environment variables for WandB and TensorBoard logs
ENV WANDB_DIR=/tmp/wandb_logs
ENV TENSORBOARD_LOGDIR=/tmp/tensorboard_logs
# Create log directories
RUN mkdir -p /tmp/wandb_logs /tmp/tensorboard_logs
COPY . /app
WORKDIR /app
RUN git config --global --add safe.directory /app
ENTRYPOINT ["/bin/bash"]