mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Dockerfile: run as user: linuxbrew
This commit refactors the Dockerfile in order to resolve build errors caused by attempting to execute `brew` commands as the root user. We need to create the `/home/linuxbrew/.linuxbrew` folder prior to copying the local directory into `/home/linuxbrew/.linuxbrew/Homebrew` (and ensure the appropriate user owns it), as failing to do so will create `/home/linuxbrew/.linuxbrew` with root user and group ownership, causing the subsequent `mkdir` command called in the second `RUN` instruction to fail. closes #11802
This commit is contained in:
parent
f22d140869
commit
77afe94446
@ -29,9 +29,11 @@ RUN apt-get update \
|
|||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& localedef -i en_US -f UTF-8 en_US.UTF-8 \
|
&& localedef -i en_US -f UTF-8 en_US.UTF-8 \
|
||||||
&& useradd -m -s /bin/bash linuxbrew \
|
&& useradd -m -s /bin/bash linuxbrew \
|
||||||
&& echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
|
&& echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers \
|
||||||
|
&& su - linuxbrew -c 'mkdir ~/.linuxbrew'
|
||||||
|
|
||||||
COPY . /home/linuxbrew/.linuxbrew/Homebrew
|
USER linuxbrew
|
||||||
|
COPY --chown=linuxbrew:linuxbrew . /home/linuxbrew/.linuxbrew/Homebrew
|
||||||
ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
|
ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
|
||||||
WORKDIR /home/linuxbrew
|
WORKDIR /home/linuxbrew
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user