-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtf-torch-conda.Dockerfile
More file actions
52 lines (45 loc) · 1.66 KB
/
tf-torch-conda.Dockerfile
File metadata and controls
52 lines (45 loc) · 1.66 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
ARG BASE_IMAGE=matifali/dockerdl:conda
FROM ${BASE_IMAGE}
ARG PYTHON_VER=3.12
USER ubuntu
WORKDIR /home/ubuntu
# Shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Accept conda tos
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
# Create deep-learning environment
RUN conda create --name DL --channel conda-forge python="${PYTHON_VER}" --yes && conda clean --all --yes
# Make new shells activate the DL environment:
RUN echo "# Make new shells activate the DL environment" >>/home/ubuntu/.bashrc && \
echo "conda activate DL" >>/home/ubuntu/.bashrc
# Download and install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/home/ubuntu/.local/bin:/home/ubuntu/.cargo/bin:${PATH}"
# Install packages inside the new environment
RUN . /opt/miniconda/etc/profile.d/conda.sh && \
conda activate DL && uv pip install --no-cache --upgrade pip && \
uv pip install --no-cache --upgrade torch torchvision torchaudio torchtext && \
uv pip install --no-cache \
ipywidgets \
jupyterlab \
lightning \
matplotlib \
nltk \
numpy \
pandas \
Pillow \
plotly \
PyYAML \
scipy \
scikit-image \
scikit-learn \
sympy \
seaborn \
tensorflow${TF_VERSION:+==${TF_VERSION}} \
tqdm && \
conda clean --all --yes && \
find /opt/miniconda/envs/DL/lib/python3.* -name '__pycache__' -exec rm -rf {} + && \
# Set path of python packages
echo "# Set path of python packages" >>/home/ubuntu/.bashrc && \
echo "export PATH=/home/ubuntu/.local/bin:\$PATH" >>/home/ubuntu/.bashrc