Troubleshooting Installing 🍺 Homebrew in a Code Studio Image
I was working to create a custom code studio that leverages Homebrew to enable experimentation for web app development and allow the end user of the code studio to install OS level packages in the container.
Warning: Since this would veer off from the OS packages on the DSS server end users should not leverage this code studio template for recipe development.
Below is what I added to a "Append to Dockerfile" block after I added the Visual Studio Code block.
# Install Basic Packages
RUN yum install -y wget
RUN yum install -y curl
RUN yum install -y screen
RUN yum install -y yum-utils
RUN yum upgrade git -y
RUN yum upgrade curl -y
# Install GitHub CLI
RUN type -p yum-config-manager >/dev/null || sudo yum install yum-utils
RUN yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
RUN yum install -y gh
RUN mkdir /home/dataiku/setup_scripts
RUN touch /home/dataiku/.bashrc
# Install Oh My Bash
RUN bash -c "$(wget https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh -O -)"
# Install NVM
# Installing Node Version Manager to allow end users to install their own node versions
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh > /home/dataiku/setup_scripts/nvm_installation.sh
RUN chmod +x /home/dataiku/setup_scripts/nvm_installation.sh
#RUN source /home/dataiku/.bashrc
# Installing Homebrew
RUN git clone https://github.com/Homebrew/brew /home/linuxbrew/.linuxbrew/Homebrew
RUN mkdir /home/linuxbrew/.linuxbrew/bin
RUN ln -s /home/linuxbrew/.linuxbrew/Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin
RUN chown -R dataiku /home/linuxbrew/
RUN echo "eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" >> /home/dataiku/.bashrc
I also added Oh My Bash, NVM, GitHub CLI as well to better enhance the shell experience.
Question: Right now I install homebrew in the standard location /home/linuxbrew/. However, when the code studio is stopped this gets deleted and we lose all of the packages that were once installed. Do you know of a way we can keep the installed packages when the code studio is stopped?
Note the homebrew directory can become big and I researched online that even using symbolic links to solve this problem can cause some homebrew packages when installed to fail.