Skip to content

Commit

Permalink
feat: add tmux, argcomplete, and bump quarto to v1.6 (#36)
Browse files Browse the repository at this point in the history
Resolves #35,
#31, #26
  • Loading branch information
pranavmishra90 authored Dec 18, 2024
2 parents 01d4b8c + a07d956 commit 3095cb7
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 53 deletions.
53 changes: 29 additions & 24 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,31 @@

FROM mambaorg/micromamba:1.5 AS micromamba

############################
ARG IMAGE_VERSION="dev"
ARG BASE_IMAGE_NAME
ARG BASE_IMAGE_SHA
ARG BASE_IMAGE_EXACT
############################

ENV BASE_IMAGE_NAME=${BASE_IMAGE_NAME}
ENV BASE_IMAGE_SHA=${BASE_IMAGE_SHA}

FROM docker.io/pranavmishra90/cuda:12.4.1-base-ubuntu22.04@sha256:50b0f0658af6b419a0a8110eff0569617d75413ebf27abd1f99a85b49d4d466f
FROM docker.io/pranavmishra90/cuda:12.6.1-base-ubuntu22.04@sha256:0a8dc3a198e14e527a0e469d10f6cea8200c6cb8b87afada742da4d794797336

# This base image was created with
# ./build.sh -d --image-name pranavmishra90/cuda --cuda-version 12.4 --os ubuntu --os-version 22.04 --arch x86_64
# taken from https://gitlab.com/nvidia/container-images/cuda || alternative: FROM nvidia/cuda:12.1.0-base-ubuntu22.04

############################
ARG IMAGE_VERSION="dev"
############################

ARG IMAGE_VERSION="dev"
ARG ISO_DATETIME
ARG BASE_IMAGE_SHA


LABEL org.opencontainers.image.title="FacsimiLab-Base"
LABEL version=${IMAGE_VERSION}
LABEL org.opencontainers.image.version=${IMAGE_VERSION}
LABEL org.opencontainers.image.authors='Pranav Kumar Mishra'
LABEL org.opencontainers.image.description="Base image || FacsimiLab - A docker image for reproducible science, leveraging Python, Nvidia CUDA, Datalad, Quarto, and more."
LABEL org.opencontainers.image.source="https://github.com/FacsimiLab/FacsimiLab-platform"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.created=${ISO_DATETIME}
LABEL org.opencontainers.image.base.name="docker.io/pranavmishra90/cuda:12.4.1-base-ubuntu22.04"
LABEL org.opencontainers.image.base.digest=${BASE_IMAGE_SHA}
USER root

ENV DEBIAN_FRONTEND="noninteractive"
ENV TZ="America/Chicago"
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

ARG CACHE_BUST="1"

RUN --mount=type=cache,target=/var/cache/apt \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
chmod 777 /tmp /opt && \
apt-get update -y \
&& apt-get install -y tzdata git ninja-build gnupg2 wget yadm && \
apt-get clean && rm -rf /var/lib/apt/lists/*
Expand All @@ -54,7 +42,7 @@ RUN mkdir -p /etc/apt/keyrings && \
wget -O- http://neuro.debian.net/lists/jammy.us-tn.full | tee /etc/apt/sources.list.d/neurodebian.sources.list && \
apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9

RUN --mount=type=cache,target=/var/cache/apt \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
apt-get update && \
apt-get --no-install-recommends install -y \
# Additional dependences
Expand All @@ -75,6 +63,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
pipx \
sudo \
tini \
tmux \
tree \
unzip \
yadm \
Expand Down Expand Up @@ -124,3 +113,19 @@ ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"]

CMD ["/bin/bash"]

ARG IMAGE_VERSION="dev"
ARG ISO_DATETIME
ARG BASE_IMAGE_NAME
ARG BASE_IMAGE_SHA


LABEL org.opencontainers.image.title="FacsimiLab-Base"
LABEL version=${IMAGE_VERSION}
LABEL org.opencontainers.image.version=${IMAGE_VERSION}
LABEL org.opencontainers.image.authors='Pranav Kumar Mishra'
LABEL org.opencontainers.image.description="Base image || FacsimiLab - A docker image for reproducible science, leveraging Python, Nvidia CUDA, Datalad, Quarto, and more."
LABEL org.opencontainers.image.source="https://github.com/FacsimiLab/FacsimiLab-platform"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.created=${ISO_DATETIME}
LABEL org.opencontainers.image.base.name=${BASE_IMAGE_NAME}
LABEL org.opencontainers.image.base.digest=${BASE_IMAGE_SHA}
30 changes: 15 additions & 15 deletions docker/base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if [ -z ${facsimilab_version_num+x} ]; then facsimilab_version_num="dev"; else e
# Adjust this according to the container name desired
CONTAINER_NAME=facsimilab-base:$facsimilab_version_num

if [ -z ${base_image_name+x} ]; then base_image_name="dev"; else echo "base_image_name is set to '$base_image_name'"; fi

##################################################################

# Initialize the build
Expand All @@ -20,29 +22,27 @@ echo "$CONTAINER_NAME"
export DOCKER_BUILDKIT=1 # use docker buildx caching
export BUILDX_METADATA_PROVENANCE=max

docker pull pranavmishra90/cuda:12.4.1-base-ubuntu22.04
docker pull ${base_image_name}

ubuntu_cuda_base_sha=$(docker inspect pranavmishra90/cuda:12.4.1-base-ubuntu22.04 --format '{{index .RepoDigests 0}}' | cut -d '@' -f2)
ubuntu_cuda_base_sha=$(docker inspect ${base_image_name} --format '{{index .RepoDigests 0}}' | cut -d '@' -f2)

echo "SHA: $ubuntu_cuda_base_sha"

if [ -n "$base_image_name" ] && [ -n "$ubuntu_cuda_base_sha" ]; then
exact_base="${base_image_name}@${ubuntu_cuda_base_sha}"
echo "Base image: $exact_base"
else
echo "Error: base_image_name or ubuntu_cuda_base_sha is not defined or empty."
exit 1
fi

# --build-arg CACHE_BUST=$(date) \
# -t gitea.mishracloud.com/pranav/$CONTAINER_NAME \
docker buildx build --progress=auto \
--pull \
docker build -t pranavmishra90/$CONTAINER_NAME \
--build-arg IMAGE_VERSION=$facsimilab_version_num \
--build-arg ISO_DATETIME=$iso_datetime \
--build-arg BASE_IMAGE_EXACT=$exact_base \
--build-arg BASE_IMAGE_NAME=$base_image_name \
--build-arg BASE_IMAGE_SHA=$ubuntu_cuda_base_sha \
--cache-from pranavmishra90/facsimilab-base:dev \
--cache-from type=registry,mode=max,oci-mediatypes=true,ref=docker.io/pranavmishra90/facsimilab-base:buildcache \
--cache-to type=registry,mode=max,oci-mediatypes=true,ref=docker.io/pranavmishra90/facsimilab-base:buildcache \
--output type=registry,push=true,name=pranavmishra90/$CONTAINER_NAME \
--output type=registry,push=true,name=pranavmishra90/facsimilab-base:dev \
--output type=docker,name=pranavmishra90/$CONTAINER_NAME \
--output type=docker,name=pranavmishra90/facsimilab-base:dev \
--metadata-file ../metadata/01-base_metadata.json \
. --file Dockerfile
. --file ./Dockerfile

# Calculate the total time
end_time=$(date +%s)
Expand Down
23 changes: 12 additions & 11 deletions docker/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ start_time=$(date +%s)
printf "\n\n\n\n\n"
echo "-----------------------------------------"

# CUDA container
#----------------------
cd cuda
# # CUDA container
# #----------------------
# cd cuda

export base_image_name="pranavmishra90/cuda:12.6.1-base-ubuntu22.04"

./build.sh -d --image-name pranavmishra90/cuda --cuda-version 12.6.1 --os ubuntu --os-version 22.04 --arch x86_64 --push
# ./build.sh -d --image-name pranavmishra90/cuda --cuda-version 12.6.1 --os ubuntu --os-version 22.04 --arch x86_64 --push

cd ..
# cd ..

# # Base container
# #----------------------
cd base

bash build.sh


# Main container
#----------------------
cd ../main
Expand All @@ -111,13 +112,13 @@ bash build.sh

# Full container
#----------------------
cd ../full
# cd ../full

# Generate the lock file from the conda environment.yml
# bash generate-lock.sh
# # Generate the lock file from the conda environment.yml
# # bash generate-lock.sh

# Build the docker container
bash build.sh
# # Build the docker container
# bash build.sh

# Finished
#----------------------
Expand Down
3 changes: 2 additions & 1 deletion docker/full/python-env/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
- black=24
- black-jupyter=24
- click>8.1
- argcomplete=3.5
- dask-core=2024

# Version control
Expand Down Expand Up @@ -78,7 +79,7 @@ dependencies:
- imbalanced-learn
- dtreeviz

# Next-generation -omics
# Next-generation Multiomics
- scanpy=1.10
- scvi-tools=1.1
- muon=0.1
Expand Down
4 changes: 2 additions & 2 deletions docker/main/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ echo "$CONTAINER_NAME"

# Download necessary files

quarto_version="1.5.56"
quarto_version="1.6.39"

# wget -nc --no-verbose https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.555/quarto-1.4.555-linux-amd64.deb -O quarto.deb
wget -nc --no-verbose https://github.com/quarto-dev/quarto-cli/releases/download/v$quarto_version/quarto-$quarto_version-linux-arm64.deb -O quarto.deb
Expand Down Expand Up @@ -130,4 +130,4 @@ docker image ls | grep facsimilab-main | grep dev

echo "#######################################################################"
echo " End of Main image build "
echo "#######################################################################"
echo "#######################################################################"
1 change: 1 addition & 0 deletions docker/main/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- black=24
- black-jupyter=24
- click>8.1
- argcomplete=3.5

# Version control
- datalad=1.1
Expand Down

0 comments on commit 3095cb7

Please sign in to comment.