我正在建立一个新的开发环境,我意识到我面临着一个小障碍。我在生产中使用Sidekiq Pro,但在开发中,我希望避免使用它,以防止许可证在其他开发人员中传播。
为此,在我的Gemfile
中,我有以下内容:
group :production do
source "https://gems.contribsys.com/" do
gem "sidekiq-pro"
end
end
但是,这个确实存在于我的Gemfile.lock
文件中:
sidekiq-pro (5.2.1)
connection_pool (>= 2.2.3)
sidekiq (>= 6.1.0)
因此,当我在docker构建中调用bundle install
时,如何防止bundle install
尝试使用sidekiq-pro
gem?问题是,由于需要身份验证,它出错了:
Step 6/12 : RUN bundle install --without production
---> Running in 0642e1440b33
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Authentication is required for gems.contribsys.com.
Please supply credentials for this source. You can do this by running:
bundle config gems.contribsys.com username:password
The command '/bin/sh -c bundle install --without production' returned a non-zero code: 17
ERROR: Service 'app' failed to build
正如您所看到的,我已经在bundle install
参数中指定了--without production
,但运气不好。
--without选项的另一个替代选项(尽管不那么优雅(是另一个名为bundle-only
的gem。它使用CLI,并且可以bundle install
特定的环境。一件好事是这个宝石不会在你的Gemfile.lock
中占据空间。
宝石回购这里
运行:
- 仅限gem安装捆绑包
- 仅捆绑生产