Rails(+ Nginx, Unicorn) Dockerfile Pro Easy useable docker for rails. more configuration, afforda
4.8K
https://github.com/seapy/dockerfiles/tree/master/rails-nginx-unicorn-pro
Easy useable docker for rails. more configuration, affordable production.
Dockerfile to your project and paste below code.# Dockerfile
FROM seapy/rails-nginx-unicorn-pro:v1.0-ruby2.1.2-nginx1.6.0
MAINTAINER seapy([email protected])
# Add here your preinstall lib(e.g. imagemagick, mysql lib, pg lib, ssh config)
#(required) Install Rails App
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install --without development test
ADD . /app
#(required) nginx port number
EXPOSE 80
unicorn gem(maybe uncomment gem 'unicorn' in Gemfile)# build your dockerfile
$ docker build -t your/project .
# run container
$ docker run -d -p 80:80 -e SECRET_KEY_BASE=secretkey your/project
Easy Ruby On Rails deploy on Docker
if your rails app required lib like imagemagick(or mysql) you must install that before Install Rails App section
RUN apt-get -qq -y install libmagickwand-dev imagemagick
RUN apt-get install -qq -y mysql-server mysql-client libmysqlclient-dev
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --force-yes libpq-dev
RUN mkdir /root/.ssh/
ADD id_rsa /root/.ssh/id_rsa
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan -t rsa bitbucket.org >> /root/.ssh/known_hosts
Copy your ~/.ssh/id_rsa to id_rsa for bitbucket connection. if you don't need to bitbucket connection, create blank id_rsa. don't forget add id_rsa to .gitignore
# your Dockerfile
...
ADD config/your-custom-nginx.conf /etc/nginx/sites-enabled/default
...
place your unicorn config to config/unicorn.rb
place your Procfile to app root
Content type
Image
Digest
sha256:c54bcd31f…
Size
372.2 MB
Last updated
almost 11 years ago
docker pull seapy/rails-nginx-unicorn-pro