From a092237d9eeb62c3de437cf728ab6382b94585c2 Mon Sep 17 00:00:00 2001 From: "joonhyung.lee" Date: Thu, 15 Aug 2024 14:09:42 +0900 Subject: [PATCH 1/3] Update Docker Compose version. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bca60a3..1626b9c 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ ls: # List all services. # Utility for installing Docker Compose on Linux (but not WSL) systems. # Visit https://docs.docker.com/compose/install for the full documentation. -COMPOSE_VERSION = v2.23.3 +COMPOSE_VERSION = v2.29.1 COMPOSE_OS_ARCH = linux-x86_64 COMPOSE_URL = https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-${COMPOSE_OS_ARCH} COMPOSE_PATH = ${HOME}/.docker/cli-plugins From 6297bb4947f3151c6b265ad37fb21ae6dc60d61f Mon Sep 17 00:00:00 2001 From: "joonhyung.lee" Date: Thu, 15 Aug 2024 14:31:59 +0900 Subject: [PATCH 2/3] Implement `tmux` scrolling of 50,000. Also unify conda environment file path names. --- docker-compose.yaml | 1 + dockerfiles/ngc.Dockerfile | 8 ++++++-- dockerfiles/simple.Dockerfile | 11 ++++++++--- dockerfiles/train.Dockerfile | 5 ++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 52cc2fd..c377312 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -91,6 +91,7 @@ services: GRP: ${GRP:-user} USR: ${USR:-user} TZ: ${TZ:-UTC} + TMUX_HIST_LIMIT: 50000 # Size of `tmux` scrolling history. # Change the `CONDA_URL` for different hardware architectures. # URLs from https://github.com/conda-forge/miniforge are recommended over # Miniconda URLs from https://docs.conda.io/en/latest/miniconda.html. diff --git a/dockerfiles/ngc.Dockerfile b/dockerfiles/ngc.Dockerfile index bb37b7d..fa2b46b 100644 --- a/dockerfiles/ngc.Dockerfile +++ b/dockerfiles/ngc.Dockerfile @@ -60,6 +60,7 @@ ARG TRUSTED_HOST ARG PIP_CONFIG_FILE=/opt/conda/pip.conf ARG PIP_CACHE_DIR=/root/.cache/pip ARG CONDA_PKGS_DIRS=/opt/conda/pkgs +ARG CONDA_ENV_FILE=/tmp/env/environment.yaml RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ --mount=type=cache,target=${CONDA_PKGS_DIRS},sharing=locked \ --mount=type=bind,readwrite,from=stash,source=/tmp/env,target=/tmp/env \ @@ -68,7 +69,7 @@ RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ echo "extra-index-url=${EXTRA_INDEX_URL}"; \ echo "trusted-host=${TRUSTED_HOST}"; \ } > ${PIP_CONFIG_FILE} && \ - $conda env update -p /opt/conda --file /tmp/env/environment.yaml + $conda env update -p /opt/conda --file ${CONDA_ENV_FILE} RUN $conda clean -fya && find /opt/conda -type d -name '__pycache__' | xargs rm -rf @@ -154,6 +155,7 @@ ARG ZSHS_PATH=${ZDOTDIR}/.zsh/zsh-syntax-highlighting COPY --link --from=stash /opt/zsh/pure ${PURE_PATH} COPY --link --from=stash /opt/zsh/zsh-syntax-highlighting ${ZSHS_PATH} +ARG TMUX_HIST_LIMIT # Search for additional Python packages installed via `conda`. RUN ln -s /opt/conda/lib/$(python -V | awk -F '[ \.]' '{print "python" $2 "." $3}') \ /opt/conda/lib/python3 && \ @@ -179,7 +181,9 @@ RUN ln -s /opt/conda/lib/$(python -V | awk -F '[ \.]' '{print "python" $2 "." $3 # Syntax highlighting must be activated at the end of the `.zshrc` file. echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \ # Configure `tmux` to use `zsh` as a non-login shell on startup. - echo "set -g default-command $(which zsh)" >> /etc/tmux.conf && \ + { echo "set -g default-command $(which zsh)"; \ + echo "set-option -g history-limit ${TMUX_HIST_LIMIT}"; \ + } >> /etc/tmux.conf && \ # For some reason, `tmux` does not read `/etc/tmux.conf`. echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' >> ${ZDOTDIR}/.zprofile && \ # Change `ZDOTDIR` directory permissions to allow configuration sharing. diff --git a/dockerfiles/simple.Dockerfile b/dockerfiles/simple.Dockerfile index 1aff473..a888738 100644 --- a/dockerfiles/simple.Dockerfile +++ b/dockerfiles/simple.Dockerfile @@ -69,7 +69,8 @@ RUN --mount=type=bind,from=stash,source=/tmp/conda,target=/tmp/conda \ printf "channels:\n - conda-forge\n - nodefaults\nssl_verify: false\n" > /opt/conda/.condarc && \ $conda clean -fya && find /opt/conda -type d -name '__pycache__' | xargs rm -rf -COPY --link ../reqs/simple-environment.yaml /tmp/req/environment.yaml +ARG CONDA_ENV_FILE=/tmp/env/environment.yaml +COPY --link ../reqs/simple-environment.yaml ${CONDA_ENV_FILE} ARG INDEX_URL ARG EXTRA_INDEX_URL @@ -82,7 +83,7 @@ RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ echo "extra-index-url=${EXTRA_INDEX_URL}"; \ echo "trusted-host=${TRUSTED_HOST}"; \ } > ${PIP_CONFIG_FILE} && \ - $conda env update --file /tmp/req/environment.yaml + $conda env update --file ${CONDA_ENV_FILE} # Cleaning must be in a separate `RUN` command to preserve the Docker cache. RUN $conda clean -fya @@ -224,6 +225,8 @@ ARG PURE_PATH=${ZDOTDIR}/.zsh/pure ARG ZSHS_PATH=${ZDOTDIR}/.zsh/zsh-syntax-highlighting COPY --link --from=stash /opt/zsh/pure ${PURE_PATH} COPY --link --from=stash /opt/zsh/zsh-syntax-highlighting ${ZSHS_PATH} + +ARG TMUX_HIST_LIMIT RUN { echo "fpath+=${PURE_PATH}"; \ echo "autoload -Uz promptinit; promptinit"; \ # Change the `tmux` path color to cyan since @@ -242,7 +245,9 @@ RUN { echo "fpath+=${PURE_PATH}"; \ # Syntax highlighting must be activated at the end of the `.zshrc` file. echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \ # Configure `tmux` to use `zsh` as a non-login shell on startup. - echo "set -g default-command $(which zsh)" >> /etc/tmux.conf && \ + { echo "set -g default-command $(which zsh)"; \ + echo "set-option -g history-limit ${TMUX_HIST_LIMIT}"; \ + } >> /etc/tmux.conf && \ # For some reason, `tmux` does not read `/etc/tmux.conf`. echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' >> ${ZDOTDIR}/.zprofile && \ # Change `ZDOTDIR` directory permissions to allow configuration sharing. diff --git a/dockerfiles/train.Dockerfile b/dockerfiles/train.Dockerfile index 6cb9aa5..bf7d797 100644 --- a/dockerfiles/train.Dockerfile +++ b/dockerfiles/train.Dockerfile @@ -524,6 +524,7 @@ ENV LD_PRELOAD=/opt/conda/libfakeintel.so${LD_PRELOAD:+:${LD_PRELOAD}} ENV LD_PRELOAD=/opt/conda/lib/libjemalloc.so${LD_PRELOAD:+:${LD_PRELOAD}} ENV MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:30000,muzzy_decay_ms:30000" +ARG TMUX_HIST_LIMIT RUN { echo "fpath+=${PURE_PATH}"; \ echo "autoload -Uz promptinit; promptinit"; \ # Change the `tmux` path color to cyan since @@ -542,7 +543,9 @@ RUN { echo "fpath+=${PURE_PATH}"; \ # Syntax highlighting must be activated at the end of the `.zshrc` file. echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \ # Configure `tmux` to use `zsh` as a non-login shell on startup. - echo "set -g default-command $(which zsh)" >> /etc/tmux.conf && \ + { echo "set -g default-command $(which zsh)"; \ + echo "set-option -g history-limit ${TMUX_HIST_LIMIT}"; \ + } >> /etc/tmux.conf && \ # For some reason, `tmux` does not read `/etc/tmux.conf`. echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' >> ${ZDOTDIR}/.zprofile && \ # Change `ZDOTDIR` directory permissions to allow configuration sharing. From 785f82020d9b2cb1b949562ef009dfe905a90c69 Mon Sep 17 00:00:00 2001 From: "joonhyung.lee" Date: Mon, 19 Aug 2024 15:59:53 +0900 Subject: [PATCH 3/3] Revert `set-option` to `set`. --- dockerfiles/ngc.Dockerfile | 2 +- dockerfiles/simple.Dockerfile | 2 +- dockerfiles/train.Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfiles/ngc.Dockerfile b/dockerfiles/ngc.Dockerfile index fa2b46b..c3f5c38 100644 --- a/dockerfiles/ngc.Dockerfile +++ b/dockerfiles/ngc.Dockerfile @@ -182,7 +182,7 @@ RUN ln -s /opt/conda/lib/$(python -V | awk -F '[ \.]' '{print "python" $2 "." $3 echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \ # Configure `tmux` to use `zsh` as a non-login shell on startup. { echo "set -g default-command $(which zsh)"; \ - echo "set-option -g history-limit ${TMUX_HIST_LIMIT}"; \ + echo "set -g history-limit ${TMUX_HIST_LIMIT}"; \ } >> /etc/tmux.conf && \ # For some reason, `tmux` does not read `/etc/tmux.conf`. echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' >> ${ZDOTDIR}/.zprofile && \ diff --git a/dockerfiles/simple.Dockerfile b/dockerfiles/simple.Dockerfile index a888738..d02952b 100644 --- a/dockerfiles/simple.Dockerfile +++ b/dockerfiles/simple.Dockerfile @@ -246,7 +246,7 @@ RUN { echo "fpath+=${PURE_PATH}"; \ echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \ # Configure `tmux` to use `zsh` as a non-login shell on startup. { echo "set -g default-command $(which zsh)"; \ - echo "set-option -g history-limit ${TMUX_HIST_LIMIT}"; \ + echo "set -g history-limit ${TMUX_HIST_LIMIT}"; \ } >> /etc/tmux.conf && \ # For some reason, `tmux` does not read `/etc/tmux.conf`. echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' >> ${ZDOTDIR}/.zprofile && \ diff --git a/dockerfiles/train.Dockerfile b/dockerfiles/train.Dockerfile index bf7d797..77ba5c4 100644 --- a/dockerfiles/train.Dockerfile +++ b/dockerfiles/train.Dockerfile @@ -544,7 +544,7 @@ RUN { echo "fpath+=${PURE_PATH}"; \ echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \ # Configure `tmux` to use `zsh` as a non-login shell on startup. { echo "set -g default-command $(which zsh)"; \ - echo "set-option -g history-limit ${TMUX_HIST_LIMIT}"; \ + echo "set -g history-limit ${TMUX_HIST_LIMIT}"; \ } >> /etc/tmux.conf && \ # For some reason, `tmux` does not read `/etc/tmux.conf`. echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' >> ${ZDOTDIR}/.zprofile && \