@@ -36,25 +36,11 @@ RUN git clone --depth 1 ${PURE_URL} /opt/zsh/pure
36
36
RUN git clone --depth 1 ${ZSHA_URL} /opt/zsh/zsh-autosuggestions
37
37
RUN git clone --depth 1 ${ZSHS_URL} /opt/zsh/zsh-syntax-highlighting
38
38
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.
43
39
ARG CONDA_URL
44
40
WORKDIR /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}
49
42
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
58
44
59
45
WORKDIR /
60
46
@@ -78,7 +64,11 @@ ARG conda=/opt/conda/bin/${CONDA_MANAGER}
78
64
# Use `docker builder prune` to clear out the build cache if it does.
79
65
ARG PIP_CACHE_DIR=/root/.cache/pip
80
66
ARG 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
+
82
72
COPY --link ../reqs/simple-environment.yaml /tmp/req/environment.yaml
83
73
84
74
ARG INDEX_URL
@@ -107,7 +97,8 @@ ARG CONDA_MANAGER
107
97
ARG conda=/opt/_conda/bin/${CONDA_MANAGER}
108
98
RUN /bin/bash /tmp/conda/miniconda.sh -b -p /opt/_conda && \
109
99
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
111
102
112
103
# #######################################################################
113
104
FROM ${BASE_IMAGE} AS conda-lock-include
@@ -186,7 +177,6 @@ FROM train-base AS train-adduser-exclude
186
177
# container registries such as Docker Hub. No users or interactive settings.
187
178
# Note that `zsh` configs are available but these images do not require `zsh`.
188
179
COPY --link --from=install-conda /opt/conda /opt/conda
189
- COPY --link --from=stash /home/linuxbrew /home/linuxbrew
190
180
191
181
# #######################################################################
192
182
FROM train-base AS train-adduser-include
@@ -206,7 +196,6 @@ RUN groupadd -f -g ${GID} ${GRP} && \
206
196
207
197
# Get conda with the directory ownership given to the user.
208
198
COPY --link --from=install-conda --chown=${UID}:${GID} /opt/conda /opt/conda
209
- COPY --link --from=stash --chown=${UID}:${GID} /home/linuxbrew /home/linuxbrew
210
199
211
200
# #######################################################################
212
201
FROM train-adduser-${ADD_USER} AS train
@@ -239,6 +228,10 @@ COPY --link --from=stash /opt/zsh/pure ${PURE_PATH}
239
228
COPY --link --from=stash /opt/zsh/zsh-syntax-highlighting ${ZSHS_PATH}
240
229
RUN { echo "fpath+=${PURE_PATH}" ; \
241
230
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" ; \
242
235
echo "prompt pure" ; \
243
236
} >> ${ZDOTDIR}/.zshrc && \
244
237
# Add autosuggestions from terminal history. May be somewhat distracting.
@@ -252,11 +245,8 @@ RUN { echo "fpath+=${PURE_PATH}"; \
252
245
echo "source ${ZSHS_PATH}/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR}/.zshrc && \
253
246
# Configure `tmux` to use `zsh` as a non-login shell on startup.
254
247
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 && \
260
250
# Change `ZDOTDIR` directory permissions to allow configuration sharing.
261
251
chmod 755 ${ZDOTDIR} && \
262
252
# Clear out `/tmp` and restore its default permissions.
0 commit comments