gpt4 book ai didi

ruby-on-rails - 你的 `bin/bundle`不是Bundler生成的,所以这个binstub无法运行

转载 作者:行者123 更新时间:2023-12-01 12:14:55 24 4
gpt4 key购买 nike

我正在尝试创建一个 Rails 容器。在我的 Dockerfile 中,我有以下内容

# 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

在容器定义中我有以下内容"命令": ["./bin/sidekiq"]

当容器运行时我得到这个错误:

你的 bin/bundle 不是由 Bundler 生成的,所以这个 binstub 不能运行。通过运行 bundle binstubs bundler --force 替换 bin/bundle,然后再次运行此命令。

现在,如果我跑

RUN bundle binstubs bundler --force

之前

RUN bundle install --binstubs

我收到这个错误

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

最佳答案

在安装包之前添加 RUN bundle binstubs bundler --force。打包程序知道这个问题。引用这里:

https://github.com/bundler/bundler/issues/6149

关于ruby-on-rails - 你的 `bin/bundle`不是Bundler生成的,所以这个binstub无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49186959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com