diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..85e82e1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# Base image with PyTorch and CUDA support +FROM pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime + +# User arguments for container setup - keeping for compatibility with Makefile +ARG user_name +ARG uid +ARG gid + +# Install system dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -y && apt-get install -y --no-install-recommends \ + libgl1-mesa-glx libglib2.0-0 \ + && apt-get -y autoclean \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && apt-get clean + +SHELL ["/bin/bash", "-c"] +RUN conda create -y --name amadeusGPT python=3.10 +ENV PATH=/opt/conda/envs/amadeusGPT/bin:$PATH +RUN conda install -y -n amadeusGPT hdf5 pytables=3.8.0 + +# Install pip packages in the user environment +RUN pip install --no-cache-dir notebook amadeusgpt +RUN pip install -U --pre deeplabcut + +# Initialize conda for bash +RUN conda init bash +RUN echo 'conda activate amadeusGPT' >> ~/.bashrc + +USER root +# Default command when container starts (activating the conda env) +WORKDIR /app +CMD ["bash", "-l"] \ No newline at end of file diff --git a/Makefile b/Makefile index 56f5a7b..c4e32af 100644 --- a/Makefile +++ b/Makefile @@ -2,3 +2,36 @@ export streamlit_app=True app: streamlit run amadeusgpt/app.py --server.fileWatcherType none --server.maxUploadSize 1000 + +IMG_TAG := 0.1 +IMG_NAME := amadeusgpt +DOCKERFILE := Dockerfile + +BUILD_ARGS := \ + --build-arg uid=$(shell id -u) \ + --build-arg gid=$(shell id -g) \ + --build-arg user_name=$(shell id -un) +build: + docker build $(BUILD_ARGS) \ + -t $(IMG_NAME):$(IMG_TAG) -f $(DOCKERFILE) . + +# [USER: ADJUST VOLUMES] +# path to the local project +HOST_SRC := /home/$(shell id -un)/AmadeusGPT +# path to the project in the container +DOCKER_SRC := /home/$(shell id -un)/AmadeusGPT +# DOCKER_DATA := /mnt +VOLUMES := \ + --volume $(HOST_SRC):$(DOCKER_SRC) + +CONTAINER_TAG :=v0.1 +CONTAINER_NAME := amadeusgpt_$(CONTAINER_TAG) + +run: + docker run --shm-size=60G --gpus all -it --name $(CONTAINER_NAME) \ + $(VOLUMES) \ + $(IMG_NAME):$(IMG_TAG) +# tail -f /dev/null + +exec: + docker exec -it $(CONTAINER_NAME) /bin/bash