Skip to content

Instantly share code, notes, and snippets.

@hecbuma
Created October 9, 2014 03:16
Show Gist options
  • Save hecbuma/004145b761039d497c53 to your computer and use it in GitHub Desktop.
Save hecbuma/004145b761039d497c53 to your computer and use it in GitHub Desktop.
# Dockerfile for installing and running Nginx
# Select ubuntu as the base image
FROM ruby:2.1.3
# Install nginx
RUN apt-get update -q
RUN apt-get install -qy nginx
RUN apt-get install -qy build-essential
RUB apt-get install -qy ruby-dev
RUN apt-get install -qy curl
RUN apt-get install -qy libssl-dev
RUN apt-get install -qy mysql-client
RUN apt-get install -qy libmysqlclient-dev
RUN apt-get install -qy imagemagick
RUN apt-get install -qy libmagickwand-dev
RUN apt-get install -qy nodejs
RUN apt-get install -qy git-core
RUN apt-get install -qy libv8-dev
RUN apt-get install -qy libxslt-dev
RUN apt-get install -qy libxml2-dev
RUN apt-get install -qy zlib1g-dev
RUN echo "daemon off;" >> /etc/nginx/nginx.confl
RUN bash -l -c 'gem install bundler --no-ri --no-rdoc'
RUN bash -l -c "gem install json -v '1.8.1'"
RUN bash -l -c "gem install nokogiri -v '1.6.3.1'"
RUN bash -l -c "gem install bcrypt -v '3.1.7'"
RUN bash -l -c "gem install kgio -v '2.9.2'"
RUN bash -l -c "gem install mysql2 -v '0.3.16'"
RUN bash -l -c "gem install raindrops -v '0.13.0'"
RUN bash -l -c "gem uninstall libv8"
RUN bash -l -c "gem install therubyracer -v '0.12.1'"
RUN bash -l -c "gem install unf_ext -v '0.0.6'"
RUN bash -l -c "gem install unicorn -v '4.8.3'"
# Add configuration files in repository to filesystem
ADD config/container/nginx-sites.conf /etc/nginx/sites-enabled/default
# Add rails project to project directory
# set WORKDIR
WORKDIR /app
# bundle install
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
ADD engines/spree_quotes /app/engines/spree_quotes
RUN /bin/bash -l -c "bundle install --without development test"
ENV RAILS_ENV production
ADD ./ /app
# Add default foreman config
ADD config/container/Procfile /app/Procfile
Run /bin/bash -l -c "bundle exec rake assets:precompile"
ADD config/container/local_env.yml /app/config/local_env.yml
# Publish port 80
EXPOSE 80
CMD bundle exec unicorn -c config/unicorn.rb -E production -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment