containers-geminabox/Dockerfile

43 lines
1.3 KiB
Docker

ARG ALPINE_VERSION=3.13.6
ARG RUBY_VERSION=2.7
ARG RUBY_PATCH=5
ARG BASE_IMAGE=registry.nulo.in/sutty/ruby
FROM ${BASE_IMAGE}:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}
ARG ALPINE_VERSION
ARG NIO4R_VERSION=2.5.8
ARG PUMA_VERSION=5.6.2
ARG HIREDIS_VERSION=0.6.3
MAINTAINER "f <f@sutty.nl>"
ENV RACK_ENV=production
ENV REDIS_SERVER=redis://redis:6379/2
RUN getent group 82 || addgroup -g 82 -S www-data
RUN adduser -s /bin/sh -G www-data -h /srv -D ruby
RUN install -dm 2750 -o ruby -g www-data /srv/gems
RUN apk add --no-cache daemonize
USER ruby
WORKDIR /srv
COPY --chown=ruby:www-data ./Gemfile .
COPY --chown=ruby:www-data ./config.ru .
COPY --chown=ruby:www-data ./${ALPINE_VERSION}/nio4r-${NIO4R_VERSION}-x86_64-linux-musl.gem .
COPY --chown=ruby:www-data ./${ALPINE_VERSION}/puma-${PUMA_VERSION}-x86_64-linux-musl.gem .
COPY --chown=ruby:www-data ./${ALPINE_VERSION}/hiredis-${HIREDIS_VERSION}-x86_64-linux-musl.gem .
# Bootstrap
RUN gem install --no-document --user-install \
./nio4r-${NIO4R_VERSION}-x86_64-linux-musl.gem \
./puma-${PUMA_VERSION}-x86_64-linux-musl.gem \
./hiredis-${HIREDIS_VERSION}-x86_64-linux-musl.gem
RUN bundle install --no-cache --clean --path ~/.gem
COPY ./monit.conf /etc/monit.d/geminabox.conf
COPY ./geminabox.sh /usr/local/bin/geminabox
USER root
EXPOSE 9292
VOLUME /srv/gems