如何修复捆绑器在 docker 容器中找不到 Rails



我正在尝试在Docker容器中运行Blazer并收到错误。

运行后

docker-compose up --build

它构建但随后出现错误

bundler: command not found: rails
Install missing gem executables with bundle install

我做错了什么?

这是我终端中的错误:

Building blazer_app
Step 1/11 : FROM ruby:2.7-slim
---> b913dc62d63c
Step 2/11 : RUN apt-get update -qq && apt-get install -y build-essential ruby-full ruby-dev libpq-dev nodejs git
---> Using cache
---> cd104b8b0995
Step 3/11 : RUN mkdir /blazer
---> Using cache
---> 408c4379fd33
Step 4/11 : WORKDIR /blazer
---> Using cache
---> 9523180b9dfb
Step 5/11 : RUN git clone https://github.com/ankane/blazer /blazer
---> Using cache
---> 74d20e03d0b4
Step 6/11 : ENV BUNDLE_PATH /blazer
---> Using cache
---> c8baefb8b45e
Step 7/11 : ENV GEM_PATH /blazer
---> Using cache
---> ca3230326184
Step 8/11 : ENV GEM_HOME /blazer
---> Using cache
---> fe6dd938bc16
Step 9/11 : RUN gem install bundler
---> Using cache
---> 92614a0a968b
Step 10/11 : RUN bundle install
---> Using cache
---> 87ef51235e08
Step 11/11 : CMD bundle exec rails s -p 1000 -b '0.0.0.0'
---> Using cache
---> 3dbf4d438d4b
Successfully built 3dbf4d438d4b
Successfully tagged blazer_blazer_app:latest
Starting blazer_postgres ... done
Starting blazer_web      ... done
Attaching to blazer_postgres, blazer_web
blazer_postgres | 
blazer_postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization
blazer_postgres | 
blazer_postgres | 2020-02-02 20:31:14.883 UTC [1] LOG:  starting PostgreSQL 12.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.2.0) 9.2.0, 64-bit
blazer_postgres | 2020-02-02 20:31:14.883 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
blazer_postgres | 2020-02-02 20:31:14.883 UTC [1] LOG:  listening on IPv6 address "::", port 5432
blazer_postgres | 2020-02-02 20:31:14.898 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
blazer_postgres | 2020-02-02 20:31:14.925 UTC [20] LOG:  database system was shut down at 2020-02-02 20:31:12 UTC
blazer_postgres | 2020-02-02 20:31:14.929 UTC [1] LOG:  database system is ready to accept connections
blazer_web    | bundler: command not found: rails
blazer_web    | Install missing gem executables with `bundle install`
blazer_web exited with code 127

docker-compose.yml:

version: '3.7'
services:
blazer_db:
container_name: blazer_postgres
image: postgres:12-alpine
volumes:
- blazer_db_vol:/blazer_postgres
ports:
- "5432:5432"
networks:
- bridge_net
blazer_app:
container_name: blazer_web
build: .
environment:
DATABASE_URL: "postgres://postgres@db:5432/postgres" # app database
BLAZER_DATABASE_URL: "postgres://dbuser:dbpass@dbhost:5432/dbname" # target database
volumes:
- blazer_app_vol:/blazer
networks:
- bridge_net
depends_on:
- blazer_db
networks:
bridge_net:
driver: bridge
volumes:
blazer_db_vol:
blazer_app_vol:

Dockerfile:

FROM ruby:2.7-slim
RUN apt-get update -qq && apt-get install -y build-essential ruby-full ruby-dev libpq-dev nodejs git
RUN mkdir /blazer
WORKDIR /blazer
RUN git clone https://github.com/ankane/blazer /blazer
ENV BUNDLE_PATH /blazer
ENV GEM_PATH /blazer
ENV GEM_HOME /blazer
RUN gem install bundler
RUN bundle install
CMD bundle exec rails s -p 1000 -b '0.0.0.0'

该存储库不包括 Rails。

我想你想检查开拓者开发项目中的安装细节。

他们 Blazer 的作者为 Blazer Docker 创建了一个新项目: https://github.com/ankane/blazer-docker

最新更新