kuboon
9/21/2018 - 9:30 PM

Dockerfile for rails

FROM ruby:2.5.1-alpine
LABEL maintainer='kuboon@trick-with.net'

ENV LANG C.UTF-8
ENV VIRTUAL_PACKAGES build-base curl-dev ruby-dev postgresql-dev yaml-dev
ENV REQUIRED_PACKAGES bash git ruby-json tzdata nodejs postgresql

RUN apk update && \
    apk upgrade && \
    apk --no-cache --virtual=.build-deps add $VIRTUAL_PACKAGES && \
    apk --no-cache add $REQUIRED_PACKAGES && \
    apk del .build-deps &&\
    rm -rf /var/cache/apk/*

WORKDIR /app
ADD Gemfile Gemfile.lock /app/
RUN bundle install --without development test --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3
COPY . .
RUN chown -R nobody:nogroup /app
RUN chmod +x run.sh

CMD ["./run.sh"]