ubuntu.Dockerfile
the Dockerfile to test on Ubuntu
-
-
Save FranklinYu/b8deda6a5093a17b575679b5808b371f to your computer and use it in GitHub Desktop.
supporting file for ohmyzsh/ohmyzsh#5280
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
# provide an admin with "sudo" permission | |
ARG admin=docker | |
RUN apt-get update && apt-get install --assume-yes | |
RUN apt-get update && apt-get install --assume-yes sudo zsh | |
RUN useradd --comment 'default administrator' \ | |
--groups sudo \ | |
--password '' \ | |
--shell '/usr/bin/zsh' \ | |
--create-home \ | |
"$admin" | |
############################### | |
# "chruby" and "ruby-install" # | |
############################### | |
# download | |
WORKDIR /tmp | |
RUN apt-get update && apt-get install --assume-yes wget | |
ARG chruby_version=0.3.9 | |
RUN wget "--output-document=chruby-$chruby_version.tar.gz" "https://github.com/postmodern/chruby/archive/v$chruby_version.tar.gz" | |
RUN tar --extract --gzip --verbose "--file=chruby-$chruby_version.tar.gz" | |
ARG ruby_install_version=0.6.0 | |
RUN wget "--output-document=ruby-install-$ruby_install_version.tar.gz" "https://github.com/postmodern/ruby-install/archive/v$ruby_install_version.tar.gz" | |
RUN tar --extract --gzip --verbose "--file=ruby-install-$ruby_install_version.tar.gz" | |
# install | |
RUN apt-get update && apt-get install --assume-yes make | |
WORKDIR "/tmp/chruby-$chruby_version" | |
RUN ["make", "install"] | |
WORKDIR "/tmp/ruby-install-$ruby_install_version" | |
RUN ["make", "install"] | |
# clean up | |
WORKDIR /tmp | |
RUN rm "chruby-$chruby_version.tar.gz" "ruby-install-$ruby_install_version.tar.gz" | |
RUN rm -r "chruby-$chruby_version" "ruby-install-$ruby_install_version" | |
# system ruby | |
RUN apt-get update && apt-get install --assume-yes ruby | |
############# | |
# Oh-My-Zsh # | |
############# | |
# dependency | |
RUN apt-get update && apt-get install --assume-yes git | |
# install and activate plugin | |
USER "$admin" | |
WORKDIR "/home/$admin" | |
RUN wget --output-document=- \ | |
https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh \ | |
| bash | |
RUN echo "source /usr/local/share/chruby/chruby.sh" >> ".zshrc" | |
RUN ["sed", "--in-place", "s/plugins=(git)/plugins=(git chruby)/", ".zshrc"] | |
# checkout my version | |
WORKDIR "/home/$admin/.oh-my-zsh" | |
RUN ["git", "remote", "add", "custom", "https://github.com/franklinyu/oh-my-zsh.git"] | |
RUN ["git", "fetch", "custom", "patch/chruby"] | |
RUN ["git", "checkout", "patch/chruby"] | |
# randomly install some version | |
WORKDIR "/home/$admin" | |
RUN ["ruby-install", "ruby", "2.1"] | |
RUN ["ruby-install", "ruby", "2.2"] | |
RUN ["ruby-install", "ruby", "2.3"] | |
# try the auto-completion with "docker run -it" | |
CMD ["zsh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment