【发布时间】:2021-07-26 01:45:03
【问题描述】:
尝试使用 sidekiq 设置我的环境,已经有一个 redis 容器启动并运行。
但是当我尝试启动它时,sidekiq 容器给了我这个错误。
bundler: command not found: sidekiq Install missing gem executables with 'bundle install'
我的 docker-compose 文件:
sidekiq:
container_name: app-sidekiq
build: .
command: bundle exec sidekiq
depends_on:
- redis
volumes:
- .:/app
env_file:
- .env
networks:
- app-network
我的 .env 文件有:
REDIS_URL=redis://limpar-api-redis:6380
我应用的 Gemfile 目前有 sidekiq gem。
当我进入我的应用容器 bash 并从中启动 sidekiq 时,它启动得很好。
Dockerfile
FROM ruby:2.7.1
ENV LANG C.UTF-8
ENV NODE_VERSION 12
ENV NODE_ENV production
ENV INSTALL_PATH /home/app/app/current
RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends nodejs postgresql-client yarn build-essential vim
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY Gemfile Gemfile.lock ./
RUN gem install bundler
RUN bundle install
COPY . $INSTALL_PATH
RUN rm -rf tmp
RUN useradd -Ms /bin/bash api -u 1001
RUN chown -R api:api /home/app /usr/local/bundle
USER root
EXPOSE 3100
CMD rails server -p 3100 -b 0.0.0.0
我的 docker 文件中缺少任何步骤吗?
【问题讨论】:
标签: ruby-on-rails docker sidekiq