@@ -36,25 +36,11 @@ RUN git clone --depth 1 ${PURE_URL} /opt/zsh/pure
3636RUN git clone --depth 1 ${ZSHA_URL} /opt/zsh/zsh-autosuggestions
3737RUN git clone --depth 1 ${ZSHS_URL} /opt/zsh/zsh-syntax-highlighting
3838
39- COPY --link ../reqs/simple-apt.requirements.txt /tmp/apt/requirements.txt
40-
41- # Both `conda` and `brew` are installed here despite worries that
42- # the differences between the base images will cause issues.
4339ARG CONDA_URL
4440WORKDIR /tmp/conda
45- RUN curl -fksSL -o /tmp/conda/miniconda.sh ${CONDA_URL} && \
46- /bin/bash /tmp/conda/miniconda.sh -b -p /opt/conda && \
47- printf "channels:\n - conda-forge\n - nodefaults\n ssl_verify: false\n " > /opt/conda/.condarc && \
48- find /opt/conda -type d -name '__pycache__' | xargs rm -rf
41+ RUN curl -fksSL -o /tmp/conda/miniconda.sh ${CONDA_URL}
4942
50- ARG CONDA_MANAGER
51- ARG PATH=/opt/conda/bin:${PATH}
52- ARG conda=/opt/conda/bin/${CONDA_MANAGER}
53- ARG HOMEBREW_CACHE=/home/linuxbrew/.cache
54- ARG BREW_URL=https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
55- RUN --mount=type=cache,target=${HOMEBREW_CACHE},sharing=locked \
56- $conda install -y curl git && $conda clean -fya && \
57- NONINTERACTIVE=1 /bin/bash -c "$(curl -fksSL ${BREW_URL})"
43+ COPY --link ../reqs/simple-apt.requirements.txt /tmp/apt/requirements.txt
5844
5945WORKDIR /
6046
@@ -78,7 +64,11 @@ ARG conda=/opt/conda/bin/${CONDA_MANAGER}
7864# Use `docker builder prune` to clear out the build cache if it does.
7965ARG PIP_CACHE_DIR=/root/.cache/pip
8066ARG CONDA_PKGS_DIRS=/opt/conda/pkgs
81- COPY --link --from=stash /opt/conda /opt/conda
67+ RUN --mount=type=bind,from=stash,source=/tmp/conda,target=/tmp/conda \
68+ /bin/bash /tmp/conda/miniconda.sh -b -p /opt/conda && \
69+ printf "channels:\n - conda-forge\n - nodefaults\n ssl_verify: false\n " > /opt/conda/.condarc && \
70+ find /opt/conda -type d -name '__pycache__' | xargs rm -rf
71+
8272COPY --link ../reqs/simple-environment.yaml /tmp/req/environment.yaml
8373
8474ARG INDEX_URL
@@ -107,7 +97,8 @@ ARG CONDA_MANAGER
10797ARG conda=/opt/_conda/bin/${CONDA_MANAGER}
10898RUN /bin/bash /tmp/conda/miniconda.sh -b -p /opt/_conda && \
10999 printf "channels:\n - conda-forge\n - nodefaults\n ssl_verify: false\n " > /opt/_conda/.condarc && \
110- $conda install conda-lock
100+ $conda install conda-lock && \
101+ find /opt/conda -type d -name '__pycache__' | xargs rm -rf
111102
112103# #######################################################################
113104FROM ${BASE_IMAGE} AS conda-lock-include
@@ -186,7 +177,6 @@ FROM train-base AS train-adduser-exclude
186177# container registries such as Docker Hub. No users or interactive settings.
187178# Note that `zsh` configs are available but these images do not require `zsh`.
188179COPY --link --from=install-conda /opt/conda /opt/conda
189- COPY --link --from=stash /home/linuxbrew /home/linuxbrew
190180
191181# #######################################################################
192182FROM train-base AS train-adduser-include
@@ -206,7 +196,6 @@ RUN groupadd -f -g ${GID} ${GRP} && \
206196
207197# Get conda with the directory ownership given to the user.
208198COPY --link --from=install-conda --chown=${UID}:${GID} /opt/conda /opt/conda
209- COPY --link --from=stash --chown=${UID}:${GID} /home/linuxbrew /home/linuxbrew
210199
211200# #######################################################################
212201FROM train-adduser-${ADD_USER} AS train
@@ -239,6 +228,10 @@ COPY --link --from=stash /opt/zsh/pure ${PURE_PATH}
239228COPY --link --from=stash /opt/zsh/zsh-syntax-highlighting ${ZSHS_PATH}
240229RUN { echo "fpath+=${PURE_PATH}" ; \
241230 echo "autoload -Uz promptinit; promptinit" ; \
231+ # Change the `tmux` path color to cyan since
232+ # the default blue is unreadable on a dark terminal.
233+ echo "zmodload zsh/nearcolor" ; \
234+ echo "zstyle :prompt:pure:path color cyan" ; \
242235 echo "prompt pure" ; \
243236 } >> ${ZDOTDIR}/.zshrc && \
244237 # Add autosuggestions from terminal history. May be somewhat distracting.
@@ -252,11 +245,8 @@ RUN { echo "fpath+=${PURE_PATH}"; \
252245 echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \
253246 # Configure `tmux` to use `zsh` as a non-login shell on startup.
254247 echo "set -g default-command $(which zsh)" >> /etc/tmux.conf && \
255- # Activate HomeBrew for Linux on login.
256- { echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' ; \
257- # For some reason, `tmux` does not read `/etc/tmux.conf`.
258- echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' ; \
259- } >> ${ZDOTDIR}/.zprofile && \
248+ # For some reason, `tmux` does not read `/etc/tmux.conf`.
249+ echo 'cp /etc/tmux.conf ${HOME}/.tmux.conf' >> ${ZDOTDIR}/.zprofile && \
260250 # Change `ZDOTDIR` directory permissions to allow configuration sharing.
261251 chmod 755 ${ZDOTDIR} && \
262252 # Clear out `/tmp` and restore its default permissions.
0 commit comments