使用Docker运行Hanami

尝试安装hanami(1.3.3)时

% docker-compose build                                                                      (master #%) [~/develop/chat-memo]
db uses an image, skipping
Building app
Step 1/8 : FROM ruby:2.6.5
 ---> d98e4013532b
Step 2/8 : RUN apt-get update -qq && apt-get install -y nodejs mariadb-client
 ---> Using cache
 ---> a78142bbe439
Step 3/8 : RUN mkdir /chat-memo
 ---> Running in e0eb9d958b18
Removing intermediate container e0eb9d958b18
 ---> 9d9a0fd16da0
Step 4/8 : WORKDIR /chat-memo
 ---> Running in 7f4da86a7bc3
Removing intermediate container 7f4da86a7bc3
 ---> e8f1bfd1e331
Step 5/8 : COPY Gemfile /chat-memo/Gemfile
 ---> 7037872d4424
Step 6/8 : COPY Gemfile.lock /chat-memo/Gemfile.lock
 ---> 50102ed83eae
Step 7/8 : RUN bundle install
 ---> Running in 1031b7632c10
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "dry-types":
  In snapshot (Gemfile.lock):
    dry-types (= 0.12.3)

  In Gemfile:
    hanami (~> 1.3) was resolved to 1.3.3, which depends on
      hanami-validations (>= 1.3, < 3) was resolved to 1.3.5, which depends on
dry-validation (~> 0.11, < 0.12) was resolved to 0.11.2, which depends
on
          dry-types (~> 0.12.0)

    hanami-model (~> 1.3) was resolved to 1.3.2, which depends on
      dry-types (~> 0.11.0)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
ERROR: Service 'app' failed to build: The command '/bin/sh -c bundle install' returned a non-zero code: 6

似乎发生了这个错误。看起来hanami-validations和hanami-model依赖的dry-types版本不同。所以事先指定了~> 0.11.0,就能成功了。

广告
将在 10 秒后关闭
bannerAds