I am trying to create a Rails container. In my Dockerfile I have the following
# Use the barebones version of Ruby 2.3.
FROM ruby:2.3-slim
# Install dependencies:
# - build-essential: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - libpq-dev: Communicate with postgres through the postgres gem
RUN apt-get update && apt-get install -qq -y --no-install-recommends \
build-essential nodejs libpq-dev
# Set an environment variable to store where the app is installed to inside
# of the Docker image. The name matches the project name out of convention only.
ENV INSTALL_PATH /dockerzon
RUN mkdir -p $INSTALL_PATH
# This sets the context of where commands will be ran in and is documented
# on Docker's website extensively.
WORKDIR $INSTALL_PATH
# Ensure gems are cached and only get updated when they change. This will
# drastically increase build times when your gems do not change.
COPY Gemfile Gemfile
# We want binstubs to be available so we can directly call sidekiq and
# potentially other binaries as command overrides without depending on
# bundle exec.
RUN bundle binstubs bundler --force
RUN bundle install --binstubs
# Copy in the application code from your work station at the current directory
# over to the working directory.
COPY . .
.
.
.
REMAINING FILE TRUNCATED
In the container definition I have the following "command": ["./bin/sidekiq"]
When the container runs I get this error:
Your bin/bundle was not generated by Bundler, so this binstub cannot run.
Replace bin/bundle by running bundle binstubs bundler --force, then run this command again.
Now, If I run
RUN bundle binstubs bundler --force
before
RUN bundle install --binstubs
I get this error
Step 8/13 : RUN bundle binstubs bundler --force
---> Running in 6ed1f7228694
Could not find gem 'rails (= 4.2.6)' in any of the gem sources listed in your
Gemfile.
ERROR: Service 'dockerzon' failed to build: The command '/bin/sh -c bundle binstubs bundler --force' returned a non-zero code: 7
add RUN bundle binstubs bundler --force before bundle install.
This issue is know to bundler. Refer here:
https://github.com/bundler/bundler/issues/6149
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With