![]() ![]() Version : " 3.7" services : rails : build : context. To find out which version you can define at the top of your file check docker -v and compare to the version reference here. Next create a docker-compose.yml file in the root directory of your project. You may have encountered a bug in the Ruby interpreter or extension libraries. Note that you’ll only need the RUN bundle config -local build.sassc -disable-march-tune-native line if you’re running into the following error: Note: if you’re only planning to use this setup to test your app locally then don’t set the RAILS_ENV to production. If you know of a better way please let me know. We don’t want to hard-code a value into our Dockerfile though as we’ll set this later via an environment variable, so this is a “hack” to get the build to pass. In order to precompile the assets during the image build a SECRET_KEY_BASE needs to be set. # Run entrypoint.sh script RUN chmod x entrypoint.sh # Precompile assets RUN SECRET_KEY_BASE = `bundle exec rails secret ` bundle exec rails assets:precompile # Fix issue with sassc gem RUN bundle config -local build.sassc -disable-march-tune-native # Install Ruby gems RUN bundle install -without development test # Copy all application files COPY. # Copy Gemfile so we can cache gems COPY Gemfile Gemfile.lock. # Throw errors if Gemfile has been modified since Gemfile.lock RUN bundle config -global frozen 1 # Extend from the official Ruby image FROM ruby:2.6.5-alpine3.11 ENV RAILS_ENV production ENV RAILS_SERVE_STATIC_FILES true ENV RAILS_LOG_TO_STDOUT true # Install required libraries on Alpine # note: build-base required for nokogiri gem # note: postgresql-dv required for pg gem RUN apk update
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |