From 1d6e11859a342fd751b3c3032dcbe9a2bdc4532d Mon Sep 17 00:00:00 2001 From: Kevin Schiesser Date: Sat, 6 Oct 2018 17:13:18 -0700 Subject: [PATCH 1/3] something that might work given .env can be decrypted --- Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d519611 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:latest + +ENV LANG C.UTF-8 +RUN apt-get update && apt-get upgrade -y +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ + build-essential \ + git \ + libpq-dev \ + nodejs \ + ruby-full \ + tzdata \ + zlib1g-dev +RUN gem install bundler + +ENV PROJROOT /home/noisebridge +WORKDIR ${PROJROOT} +RUN mkdir -p ${PROJROOT} +COPY . ${PROJROOT} +RUN mkdir -p ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && git archive master | tar -x -C ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) + +RUN cd ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && bundle install +RUN cd ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && RAILS_ENV=production bin/rake assets:precompile + +CMD ["passanger-config", "restart-app", ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD)] From 37e543d03b44f830e679448650d1a9a8dd84be3d Mon Sep 17 00:00:00 2001 From: Kevin Schiesser Date: Sat, 6 Oct 2018 19:48:38 -0700 Subject: [PATCH 2/3] include passenger-config setup --- Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d519611..7567e8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,18 @@ ENV LANG C.UTF-8 RUN apt-get update && apt-get upgrade -y RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ build-essential \ + dirmngr \ git \ + gnupg \ libpq-dev \ nodejs \ ruby-full \ tzdata \ zlib1g-dev +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 +RUN sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list' +RUN apt-get update +RUN apt-get install -y libnginx-mod-http-passenger RUN gem install bundler ENV PROJROOT /home/noisebridge @@ -21,4 +27,4 @@ RUN mkdir -p ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && git archive RUN cd ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && bundle install RUN cd ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && RAILS_ENV=production bin/rake assets:precompile -CMD ["passanger-config", "restart-app", ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD)] +CMD ["passenger-config", "restart-app", "${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD)"] From 15fdd70ab6675af152459f57ef7099de8a0d50e7 Mon Sep 17 00:00:00 2001 From: Kevin Schiesser Date: Mon, 8 Oct 2018 08:57:24 -0700 Subject: [PATCH 3/3] use ruby-stretch base image and puma --- Dockerfile | 19 ++++++++++--------- Gemfile | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7567e8d..c380df4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:latest +FROM ruby:2.4 ENV LANG C.UTF-8 RUN apt-get update && apt-get upgrade -y @@ -9,22 +9,23 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ gnupg \ libpq-dev \ nodejs \ - ruby-full \ tzdata \ zlib1g-dev -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 -RUN sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list' -RUN apt-get update -RUN apt-get install -y libnginx-mod-http-passenger -RUN gem install bundler +# RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 +# RUN sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list' +# RUN apt-get update +# RUN apt-get install -y libnginx-mod-http-passenger +RUN gem install bundler puma ENV PROJROOT /home/noisebridge +ENV RAILS_ENV production WORKDIR ${PROJROOT} RUN mkdir -p ${PROJROOT} COPY . ${PROJROOT} RUN mkdir -p ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && git archive master | tar -x -C ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) +# RUN mv ${PROJROOT}/.env ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD)/.env RUN cd ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && bundle install -RUN cd ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && RAILS_ENV=production bin/rake assets:precompile +RUN cd ${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD) && bin/rake assets:precompile -CMD ["passenger-config", "restart-app", "${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD)"] +CMD ["bundle", "exec", "puma", "${PROJROOT}/noisebridge-donate-$(git rev-parse HEAD)"] diff --git a/Gemfile b/Gemfile index 709f1e2..8057c9c 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gem 'dotenv-rails' gem 'httparty' gem 'jquery-rails' gem 'pg' +gem 'puma' gem 'rails', '~> 5.0.0' gem 'sass-rails', '~> 5.0' gem 'secure_headers'