diff --git a/Dockerfile b/Dockerfile index 9377fb3..5b749c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,4 @@ -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 -WORKDIR /srv/http -COPY --chown=app:www-data ./Gemfile . -COPY --chown=app:www-data ./config.ru . -RUN bundle install --path=./vendor - -FROM sutty/monit:latest +FROM sutty/monit:3.11.6 ENV RACK_ENV=production RUN addgroup -g 82 -S www-data @@ -21,14 +8,21 @@ RUN apk add --no-cache ruby ruby-bundler ruby-json RUN apk add --no-cache daemonize COPY ./monit.conf /etc/monit.d/geminabox.conf COPY ./geminabox.sh /usr/local/bin/geminabox -COPY --from=build /srv/http /srv/http + RUN install -dm 2750 -o app -g www-data /srv/gems 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 apk add --no-cache patch && cd /usr/lib/ruby/2.7.0 && patch -Np 0 -i /tmp/rubygems-platform-musl.patch && apk del patch +RUN cd /usr/lib/ruby/2.6.0 && patch -Np 0 -i /tmp/rubygems-platform-musl.patch +USER app +WORKDIR /srv/http +COPY --chown=app:www-data ./Gemfile . +COPY --chown=app:www-data ./config.ru . +RUN bundle install --path=./vendor + +USER root EXPOSE 9292 VOLUME /srv/gems diff --git a/rubygems-platform-musl.patch b/rubygems-platform-musl.patch index d6db223..4034704 100644 --- a/rubygems-platform-musl.patch +++ b/rubygems-platform-musl.patch @@ -1,3 +1,14 @@ +--- rubygems/platform.rb.orig ++++ rubygems/platform.rb +@@ -89,7 +89,7 @@ + when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ] + when /^dotnet$/ then [ 'dotnet', nil ] + when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ] +- when /linux/ then [ 'linux', $1 ] ++ when /linux-?(\w+)?/ then [ 'linux', $1 ] + when /mingw32/ then [ 'mingw32', nil ] + when /(mswin\d+)(\_(\d+))?/ then + os, version = $1, $3 --- rubygems.rb.orig +++ rubygems.rb @@ -764,10 +764,7 @@