From c6c26124c838d9c2e77c2a50b6a7bfd3767bd8b6 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Wed, 8 Oct 2014 15:14:03 +0200 Subject: [PATCH] Docker additions --- .dockerignore | 5 +++++ Dockerfile | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..ef620fed --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +spec +log +tmp +coverage +public/system diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0aa7150f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM bterkuile/ruby-base + +MAINTAINER Benjamin ter Kuile + +# Add 'web' user which will run the application +RUN adduser web --home /home/web --shell /bin/bash --disabled-password --gecos "" + +# Separate Gemfile ADD so that `bundle install` can be cached more effectively +ADD Gemfile /var/www/ +ADD Gemfile.lock /var/www/ +RUN chown -R web:web /var/www &&\ + mkdir -p /var/bundle &&\ + chown -R web:web /var/bundle +RUN su -c "cd /var/www && bundle install --deployment --without development test --path /var/bundle" -s /bin/bash -l web + +# Add application source +ADD . /var/www +RUN chown -R web:web /var/www + +USER web + +WORKDIR /var/www + +CMD ["bundle", "exec", "foreman", "start"]