Created
February 18, 2020 10:04
-
-
Save amandasantanati/2173c900ebb8091388176f70b7fa4317 to your computer and use it in GitHub Desktop.
Dockerfile for ubuntu 18.04 based system with Rails and SSH
This file contains 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:18.04 | |
LABEL mantainer='Amanda Santana' | |
RUN apt-get update | |
RUN apt-get install -y openssh-server vim curl git sudo zip | |
RUN apt-get update | |
RUN apt-get install -y build-essential automake autoconf \ | |
bison libssl-dev libyaml-dev libreadline6-dev \ | |
zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \ | |
gawk g++ gcc make libc6-dev patch libsqlite3-dev sqlite3 \ | |
libtool pkg-config libpq-dev nodejs ruby-full | |
RUN mkdir /var/run/sshd | |
RUN echo 'root:root' |chpasswd | |
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config | |
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config | |
RUN useradd -ms /bin/bash app | |
RUN adduser app sudo | |
RUN echo 'app:app' |chpasswd | |
USER app | |
RUN /bin/bash -l -c "echo 'export PATH=$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' >> $HOME/.bashrc" | |
RUN /bin/bash -l -c "echo 'export PATH=$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' >> $HOME/.profile" | |
RUN /bin/bash -l -c 'source $HOME/.bashrc' | |
RUN /bin/bash -l -c "curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash" | |
RUN /bin/bash -l -c "rbenv install 2.7.0" | |
RUN /bin/bash -l -c "rbenv global 2.7.0" | |
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc " | |
RUN /bin/bash -l -c "gem install bundler --no-document" | |
RUN /bin/bash -l -c "gem install rails -v 6.0.2.1" | |
USER root | |
RUN mkdir /workspace | |
VOLUME /workspace | |
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
EXPOSE 22 | |
EXPOSE 3000 | |
CMD ["/usr/sbin/sshd", "-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment