Skip to content

Instantly share code, notes, and snippets.

@mikezuniga
Created April 18, 2017 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikezuniga/fc1d3681f5addf6d9b930fe6aa32cad2 to your computer and use it in GitHub Desktop.
Save mikezuniga/fc1d3681f5addf6d9b930fe6aa32cad2 to your computer and use it in GitHub Desktop.
FROM centos:centos7
# TODO: Put the maintainer name in the image metadata
MAINTAINER Miguel Z <miguelzuniga@gmail.com>
# TODO: Rename the builder environment variable to inform users about application you provide them
ENV RAILS_VERSION 4.0
# TODO: Install required packages here:
RUN yum install -y sqlite-devel sqlite patch wget readline readline-devel libcurl-devel gcc gcc-c++ libxml2 libxml2-devel libxslt libxslt-devel libxml libssl openssl-devel libssl-devel openssl libyaml httpd-devel httpd \
&& wget https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.7.tar.gz -O /tmp/ruby-2.1.7.tar.gz \
&& cd /opt \
&& tar xvfz /tmp/ruby-2.1.7.tar.gz \
&& cd ruby-2.1.7 \
&& ./configure --prefix=/opt/ruby && make && make install \
&& export PATH=/opt/ruby/bin:$PATH \
&& gem install rails --no-ri --no-rdoc \
&& gem install passenger --no-ri --no-rdoc \
&& passenger-install-apache2-module -a --languages 'ruby' \
&& passenger-install-apache2-module --languages 'ruby' --snippet > /etc/httpd/conf.d/passenger.conf \
&& rm -rf /tmp/ruby-* \
&& rm -rf /opt/ruby-2.1.7* \
&& mkdir -p /opt/app-root/src \
&& yum clean all -y
# Copy apache rails config file
COPY ./etc/rails.conf /etc/httpd/conf.d/
# TODO: Drop the root user and make the content of /opt/app-root owned by user 1001
RUN chown -R apache.apache /opt/app-root
RUN chmod -R 755 /opt/app-root
USER root
EXPOSE 8080
CMD ["/usr/bin/httpd -DFOREGROUND"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment