Skip to content

Commit

Permalink
middle commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ionshiv committed Oct 11, 2024
1 parent 25f9274 commit 3d72bee
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 29 deletions.
6 changes: 6 additions & 0 deletions .inputrc
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,9 @@ set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
set enable-bracketed-paste
10 changes: 4 additions & 6 deletions build-local-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ image="pharmbio-notebook"
echo "tensorflow_version=$tensorflow_version"
echo "tag=$tag"
echo "image=$image"
#switch to buildx build
#switched to buildx build
# Build docker image for this container.
# docker buildx build --no-cache -t ghcr.io/pharmbio/$image:$tag \
# --build-arg BASE_IMAGE=tensorflow/tensorflow:${tensorflow_version}-jupyter \
# --build-arg FRAMEWORK=cpu \
# -f ./docker/env.Dockerfile . || exit 1
docker buildx build --no-cache -t ghcr.io/pharmbio/$image:${tag}-gpu \
# -f ./docker/env.cpu.Dockerfile . || exit 1
DOCKER_BUILDKIT=1 docker buildx build --no-cache -t ghcr.io/pharmbio/$image:${tag}-gpu \
--build-arg BASE_IMAGE=tensorflow/tensorflow:${tensorflow_version}-gpu-jupyter \
--build-arg FRAMEWORK=cuda \
-f docker/env.Dockerfile . || exit 1
-f docker/env.cuda.Dockerfile . || exit 1

#docker push "ghcr.io/pharmbio/$image:$tag-devel"
30 changes: 7 additions & 23 deletions docker/env.Dockerfile → docker/env.cpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,13 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir -r requirements.txt

# Conditional install based on FRAMEWORK argument
RUN <<EOF
if [ "$FRAMEWORK" = "cuda" ]; then
echo "Installing for CUDA framework"
python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \
torch==2.2.1 \
torchvision \
torchaudio;
python3 -m pip install \
--extra-index-url=https://pypi.nvidia.com \
cudf-cu12==24.6.* dask-cudf-cu12==24.6.* cuml-cu12==24.6.* \
cugraph-cu12==24.6.* cuspatial-cu12==24.6.* cuproj-cu12==24.6.* \
cuxfilter-cu12==24.6.* cucim-cu12==24.6.* pylibraft-cu12==24.6.* \
raft-dask-cu12==24.6.* cuvs-cu12==24.6.*;
elif [ "$FRAMEWORK" = "cpu" ]; then
echo "Installing for CPU framework"
python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu \
torch==2.2.1 \
torchvision \
torchaudio;
else
echo "Error: unknown hardware"
exit 1
fi
RUN <<EOF
echo "Installing for CPU framework"
python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu \
torch==2.4.1 \
torchvision \
torchaudio;

EOF


Expand Down
119 changes: 119 additions & 0 deletions docker/env.cuda.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Base image should be specified with --build-arg during build
# syntax=docker/dockerfile:1.4
ARG BASE_IMAGE="tensorflow/tensorflow:latest" # Example default

FROM $BASE_IMAGE
# ARG FRAMEWORK need to be after the build stage FROM (since it is used in another build process)


# Set shell
ENV SHELL=/bin/bash

# Set timezone
ENV TZ=Europe/Stockholm
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install base dependencies
ENV DEBIAN_FRONTEND=noninteractive
# >apt_installs.txt to save instead of executing
RUN <<EOF
apt-get update
apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
software-properties-common \
libegl1-mesa-dev \
libgles2-mesa-dev \
python3-pip \
gnupg \
tmux \
sudo \
ssh \
nano \
mysql-client \
libpq-dev \
git \
vim \
wget \
curl \
ncdu \
less \
rsync \
zip \
unzip \
iputils-ping \
sqlite \
sqlite3 \
libgl1-mesa-glx \
python3-venv \
openjdk-17-jdk-headless \
EOF

# Install Rust (comment out if not needed)
#RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
#ENV PATH="/root/.cargo/bin:${PATH}"
#RUN cargo --help

# Upgrade pip and install base Python packages
COPY requirements.txt .
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir -r requirements.txt


# Breakpoint - temporary shell for debugging
RUN --mount=type=cache,target=/tmp \
echo "Entering breakpoint shell"; \
sleep infinity

RUN echo "Step 2: Continuing after breakpoint"

RUN <<EOF
echo "Installing for CUDA framework"
python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \
torch==2.4.1 \
torchvision \
torchaudio;
EOF

# RUN python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \
# torch==2.2.1 \
# torchvision \
# torchaudio;
# RUN python3 -m pip install \
# --extra-index-url=https://pypi.nvidia.com \
# cudf-cu12==24.6.* dask-cudf-cu12==24.6.* cuml-cu12==24.6.* \
# cugraph-cu12==24.6.* cuspatial-cu12==24.6.* cuproj-cu12==24.6.* \
# cuxfilter-cu12==24.6.* cucim-cu12==24.6.* pylibraft-cu12==24.6.* \
# raft-dask-cu12==24.6.* cuvs-cu12==24.6.*;




# Add pharmbio templates, examples and misc
#WORKDIR /pharmbio/
#COPY README.md .
#COPY notebooks/* ./notebooks/

# Custom bashrc
COPY bash.bashrc /etc/bash.bashrc

# Set up user
RUN useradd -m -s /bin/bash -N -u 1000 jovyan && \
echo "jovyan ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Set ownership for directories jovyan might need to modify
RUN chown jovyan /opt/

# Final user and work directory setup
USER jovyan
WORKDIR /home/jovyan

#
# The entrypoint will first copy /pharmbio/ files to user home
# This is because /home/jovyan will be mountpoint for persistent volume
# and all contents that is there already in this image will be masqued with
# persistent volume contents
# Then the entrypoint will start jupyter notebook server
#
COPY entrypoint.sh /
CMD /entrypoint.sh

0 comments on commit 3d72bee

Please sign in to comment.