docker-compose.yml 无法使用自定义配置启动 ruby​​ 应用程序

发布于 2025-01-09 02:31:43 字数 1755 浏览 1 评论 0原文

我有一个小型机架应用程序,我使用 docker-compose.yml 为其配置开发环境 该

应用程序将安装到图像,没有 docker,它可以使用bundle execrackup 正常运行 - p 3030

此配置的想法来自

rel="nofollow noreferrer">这篇文章适用于节点应用程序,但在将其移植到 ruby​​ Makefile

install:
  docker-compose -f docker-compose.builder.yml run --rm install
run:
  docker-compose up

docker-compose.builder.yml

version: '2'
services:
  base:
    image: ruby:3.0.3
    volumes:
      - .:/usr/src/service/
    working_dir: /usr/src/service/
  install:
    extends:
      service: base
    command: bash -c "bundle config set --local path './.vendor' && bundle install"

docker-compose.yml

version: '3'
services:
  dev:
    image: ruby:3.0.3
    volumes:
      - .:/usr/src/service
    working_dir: /usr/src/service
    command: /usr/local/bin/bundle exec ./.vendor/ruby/3.0.0/bin/rackup -p 3030
    ports:
      - 3030:3030

我的安装脚本似乎工作正常好吧,

$ make install
docker-compose -f docker-compose.builder.yml run --rm install
WARNING: Found orphan containers (backbone_dev_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating backbone_install_run ... done
...
Bundle complete! 18 Gemfile dependencies, 64 gems now installed.
Bundled gems are installed into `./.vendor`

我的问题似乎是我的脚本运行我的应用程序

$ make run
docker-compose up
Starting backbone_dev_1 ... done
Attaching to backbone_dev_1
dev_1  | /usr/bin/env: ‘ruby_executable_hooks’: No such file or directory
backbone_dev_1 exited with code 127

I have a small rack application that im configuring a development environment for, using docker-compose.yml

The application will be mounted to an image, without docker it runs just fine using bundle exec rackup -p 3030

the idea for this configuration comes from this article for a node app, but im running into some snags when porting it over to ruby

Makefile

install:
  docker-compose -f docker-compose.builder.yml run --rm install
run:
  docker-compose up

docker-compose.builder.yml

version: '2'
services:
  base:
    image: ruby:3.0.3
    volumes:
      - .:/usr/src/service/
    working_dir: /usr/src/service/
  install:
    extends:
      service: base
    command: bash -c "bundle config set --local path './.vendor' && bundle install"

docker-compose.yml

version: '3'
services:
  dev:
    image: ruby:3.0.3
    volumes:
      - .:/usr/src/service
    working_dir: /usr/src/service
    command: /usr/local/bin/bundle exec ./.vendor/ruby/3.0.0/bin/rackup -p 3030
    ports:
      - 3030:3030

my install script seems to work just fine

$ make install
docker-compose -f docker-compose.builder.yml run --rm install
WARNING: Found orphan containers (backbone_dev_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating backbone_install_run ... done
...
Bundle complete! 18 Gemfile dependencies, 64 gems now installed.
Bundled gems are installed into `./.vendor`

my issue seems to be with my script to run my app

$ make run
docker-compose up
Starting backbone_dev_1 ... done
Attaching to backbone_dev_1
dev_1  | /usr/bin/env: ‘ruby_executable_hooks’: No such file or directory
backbone_dev_1 exited with code 127

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文