Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Last active December 21, 2020 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krainboltgreene/11334e0f1c1810452c5bc3b7535e8fa4 to your computer and use it in GitHub Desktop.
Save krainboltgreene/11334e0f1c1810452c5bc3b7535e8fa4 to your computer and use it in GitHub Desktop.
FROM heroku/heroku:20-build as build
ARG BUNDLE_GEMS__CONTRIBSYS__COM
ENV STACK heroku-20
ENV RACK_ENV production
ENV RAILS_ENV production
ENV PORT 8080
WORKDIR /home/application/
RUN curl -s --location https://github.com/heroku/heroku-buildpack-ruby/archive/v221.tar.gz | tar -xzC .
COPY app/ app/
COPY bin/ bin/
COPY config/ config/
COPY db/ db/
COPY lib/ lib/
COPY public/ public/
COPY vendor/ vendor/
COPY config.ru config.ru
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
COPY Rakefile Rakefile
# This avoids an asset precompile
RUN mkdir public/assets/
RUN touch public/assets/manifest-empty.json
RUN heroku-buildpack-ruby-221/bin/detect /home/application/
RUN heroku-buildpack-ruby-221/bin/compile /home/application/ /tmp/ruby/cache /tmp/ruby/env
FROM heroku/heroku:20
ENV RACK_ENV production
ENV RAILS_ENV production
ENV PORT 8080
RUN useradd --create-home application
USER application
WORKDIR /home/application/
COPY --chown=application --from=build /home/application/app/ /home/application/app/
COPY --chown=application --from=build /home/application/bin/ /home/application/bin/
COPY --chown=application --from=build /home/application/config/ /home/application/config/
COPY --chown=application --from=build /home/application/db/ /home/application/db/
COPY --chown=application --from=build /home/application/lib/ /home/application/lib/
COPY --chown=application --from=build /home/application/public/ /home/application/public/
COPY --chown=application --from=build /home/application/vendor/ /home/application/vendor/
COPY --chown=application --from=build /home/application/config.ru /home/application/config.ru
COPY --chown=application --from=build /home/application/Gemfile /home/application/Gemfile
COPY --chown=application --from=build /home/application/Gemfile.lock /home/application/Gemfile.lock
COPY --chown=application --from=build /home/application/Rakefile /home/application/Rakefile
COPY --chown=application --from=build /home/application/.profile.d/ /home/application/.profile.d/
EXPOSE $PORT
SHELL ["bin/docker-ruby-entrypoint"]
ENTRYPOINT ["bin/docker-ruby-entrypoint"]
CMD ["bin/rails", "server"]
FROM heroku/heroku:20-build as build
ARG BUNDLE_GEMS__CONTRIBSYS__COM
ENV STACK heroku-20
ENV RACK_ENV production
ENV RAILS_ENV production
ENV NODE_ENV production
ENV PORT 8080
WORKDIR /home/application/
RUN curl -s --location https://github.com/heroku/heroku-buildpack-ruby/archive/v221.tar.gz | tar -xzC .
RUN curl -s --location https://github.com/heroku/heroku-buildpack-nodejs/archive/v176.tar.gz | tar -xzC .
COPY app/ app/
COPY bin/ bin/
COPY config/ config/
COPY db/ db/
COPY lib/ lib/
COPY public/ public/
COPY vendor/ vendor/
COPY config.ru config.ru
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
COPY Rakefile Rakefile
COPY babel.config.js babel.config.js
COPY package.json package.json
COPY postcss.config.js postcss.config.js
COPY yarn.lock yarn.lock
RUN heroku-buildpack-ruby-221/bin/detect /home/application/
RUN heroku-buildpack-ruby-221/bin/compile /home/application/ /tmp/ruby/cache /tmp/ruby/env
RUN heroku-buildpack-nodejs-176/bin/detect /home/application/
RUN heroku-buildpack-nodejs-176/bin/compile /home/application/ /tmp/nodejs/cache /tmp/nodejs/env
FROM heroku/heroku:20
RUN useradd --create-home application
USER application
WORKDIR /home/application/
COPY --chown=application --from=build /home/application/public/ /home/application/public/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment