首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Rails 6+ Docker =Webpacker::清单::MissingEntryError?

Rails 6+ Docker =Webpacker::清单::MissingEntryError?
EN

Stack Overflow用户
提问于 2019-11-14 23:05:44
回答 1查看 2.9K关注 0票数 12

试图将我的Rails应用程序作为Docker容器运行,但打开页面时出现了以下错误:

代码语言:javascript
运行
复制
Webpacker can't find application in /app/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}

当我使用简单的rails s运行应用程序时,它工作得很好,并且创建了public/packs文件夹。在日志中也有

代码语言:javascript
运行
复制
/usr/local/bundle/gems/webpacker-4.2.0/lib/webpacker/runner.rb:13:in ``': No such file or directory - yarn (Errno::ENOENT)

错误,尽管我检查了容器纱线-v显示已经安装了纱线。

Dockerfile

代码语言:javascript
运行
复制
FROM ruby:2.6.3
RUN apt-get update -qq \
    && curl -sL https://deb.nodesource.com/setup_12.x  | bash - \
    && apt-get install -y nodejs \
    && curl -o- -L https://yarnpkg.com/install.sh | bash
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install
COPY . /app

# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000

# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]

docker-compose.yml

代码语言:javascript
运行
复制
version: '3'
services:
  webpacker:
    build: .
    env_file:
      - '.env.docker'
    command: ./bin/webpack-dev-server
    volumes:
      - .:/app
    ports:
      - '3035:3035'
  web:
    build: .
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    volumes:
      - .:/app
    ports:
      - "3000:3000"

.env.docker

代码语言:javascript
运行
复制
NODE_ENV=development
RAILS_ENV=development
WEBPACKER_DEV_SERVER_HOST=0.0.0.0
EN

回答 1

Stack Overflow用户

发布于 2020-10-17 06:47:01

按照以下步骤操作。

(1)对接-合成run #{rails_app_name}

然后再用

(二) docker-compose build #{rails_app_name}

(三) docker-compose up

参考: 1:https://github.com/rails/webpacker/issues/1568

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58867887

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档