Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker image #3

Open
maxmeyer opened this issue Oct 24, 2017 · 0 comments
Open

Add docker image #3

maxmeyer opened this issue Oct 24, 2017 · 0 comments

Comments

@maxmeyer
Copy link

maxmeyer commented Oct 24, 2017

Would you mind to add an Docker Image? Maybe something based on the given Dockerfile. This example uses the multistage build feature of docker which should be available on hub.docker.com since June 2017.

FROM ruby:2.4
MAINTAINER xxx

ENV RAILS_ENV=production

RUN apt-get update \
  && apt-get install -y libc-dev gcc g++ binutils build-essential

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
  && apt-get install -y nodejs

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
  && echo "deb http://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list \
  && apt-get update -y \
  && apt-get install -y yarn

ADD src/Gemfile* /tmp/app/
WORKDIR /tmp/app

RUN gem install bundler \
  && bundle install --without development test \
  && bundle update \
  && rm -r /tmp/app/

ADD src/ /srv/app/
ADD files/latest/config/*.rb /srv/app/config/initializers/
WORKDIR /srv/app/

RUN yarn install

RUN sed -i "s/:debug/:info/" config/environments/production.rb

RUN gem install bundler \
  && bundle install --without development test

RUN rake assets:precompile

ENTRYPOINT ["/usr/local/bundle/bin/rails"]
CMD ["server"]

######

FROM ruby:2.4
MAINTAINER xxx

ENV RAILS_ENV=production
ENV RAILS_LOG_TO_STDOUT=true

RUN apt-get update \
  && apt-get install -y nodejs

RUN rm -fr /usr/local/bundle/

COPY --from=0 /usr/local/bundle/ /usr/local/bundle/
COPY --from=0 /srv/app/ /srv/app/

WORKDIR /srv/app/

ENTRYPOINT ["/usr/local/bundle/bin/rails"]
CMD ["server"]
@maxmeyer maxmeyer mentioned this issue Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant