diff --git a/Dockerfile b/Dockerfile index c50c0f3..6feb536 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ FROM sutty/sdk-ruby:latest AS build MAINTAINER "f " +ENV RACK_ENV=production + RUN install -dm 2750 -o app -g www-data /srv/http USER app @@ -8,14 +10,13 @@ WORKDIR /srv/http COPY --chown=app:www-data ./Gemfile . COPY --chown=app:www-data ./config.ru . RUN bundle install --path=./vendor -RUN find ./vendor -name '*.so' | xargs -r strip --strip-unneeded FROM sutty/daemonize:latest AS daemonize RUN echo /home/builder/packages/home > /etc/apk/repositories RUN apk add --no-cache daemonize -FROM sutty/monit +FROM sutty/monit:latest ENV RACK_ENV=production RUN addgroup -g 82 -S www-data @@ -32,7 +33,7 @@ RUN chmod 755 /usr/local/bin/geminabox # https://github.com/rubygems/rubygems/issues/2918 # https://gitlab.alpinelinux.org/alpine/aports/issues/10808 COPY ./rubygems-platform-musl.patch /tmp/ -RUN cd /usr/lib/ruby/2.5.0 && patch -Np 0 -i /tmp/rubygems-platform-musl.patch +RUN cd /usr/lib/ruby/2.6.0 && patch -Np 0 -i /tmp/rubygems-platform-musl.patch EXPOSE 9292 VOLUME /srv/gems diff --git a/Gemfile b/Gemfile index 5236acc..17c9e0e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,8 @@ -source 'https://rubygems.org' +if ENV['RACK_ENV'] == 'production' + source 'https://gems.sutty.nl' +else + source 'https://rubygems.org' +end gem 'redis-rack' gem 'hiredis' diff --git a/geminabox.sh b/geminabox.sh index c94c01f..c0d9153 100644 --- a/geminabox.sh +++ b/geminabox.sh @@ -3,6 +3,7 @@ set -e dir=/srv/gems pid=/tmp/geminabox.pid +log=/tmp/geminabox.log chown -R app:www-data ${dir} cd ${dir} @@ -13,6 +14,6 @@ for link in Gemfile Gemfile.lock .bundle config.ru vendor; do done rm -f ${pid} -daemonize -p ${pid} -l ${pid} -o ${dir}/access.log -e ${dir}/error.log \ +daemonize -p ${pid} -l ${pid} -o ${log} -e ${log} \ -c ${dir} -a -u app \ `which bundle` exec rackup