Dockerfile: set HOMEBREW_* variables

This matches what `brew shellenv` prints and make shell completions work
in containers (and codespaces). Evaluating `brew shellenv` does not work
because `brew shellenv` detects that `PATH` is already correctly set and
thus exits without printing anything.

I don't think `MANPATH` and `INFOPATH` (which are also printed by
`brew shellenv`) are needed in the Dockerfile because `man` and `info`
are not installed in the image.
This commit is contained in:
Ruoyu Zhong
2026-05-09 01:37:22 +08:00
parent 68393841da
commit de045bf739
+3
View File
@@ -68,6 +68,9 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
USER linuxbrew
ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}" \
HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew \
HOMEBREW_CELLAR=/home/linuxbrew/.linuxbrew/Cellar \
HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew/Homebrew \
XDG_CACHE_HOME=/home/linuxbrew/.cache
WORKDIR /home/linuxbrew