Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/tmux #211

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions dockerfiles/ngc.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

Expand Down Expand Up @@ -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 && \
Expand All @@ -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 -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.
Expand Down
11 changes: 8 additions & 3 deletions dockerfiles/simple.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 -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.
Expand Down
5 changes: 4 additions & 1 deletion dockerfiles/train.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 -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.
Expand Down