Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ';在任何源(Bundler::GemNotFound)和#x27;在创建我的api服务时_Ruby On Rails_Docker - Fatal编程技术网

Ruby on rails ';在任何源(Bundler::GemNotFound)和#x27;在创建我的api服务时

Ruby on rails ';在任何源(Bundler::GemNotFound)和#x27;在创建我的api服务时,ruby-on-rails,docker,Ruby On Rails,Docker,docker compose.yml version: "3.7" services: courseshine_redis: container_name: courseshine_redis image: redis:latest command: redis-server --requirepass ${POSTGRES_PASSWORD} restart: always env_file: .env stdin_ope

docker compose.yml

version: "3.7"
services:
  courseshine_redis:
    container_name: courseshine_redis
    image: redis:latest
    command: redis-server --requirepass ${POSTGRES_PASSWORD}
    restart: always
    env_file: .env
    stdin_open: true
    ports:
      - ${REDIS_PORT}:${REDIS_PORT}
    volumes:
      - courseshine_redis_data:/data
    networks:
      - internal

  courseshine_db:
    container_name: courseshine_db
    build:
      context: ../..
      dockerfile: courseshine_docker/development/courseshine_db/Dockerfile
    restart: always
    env_file: .env
    environment:
      - POSTGRES_MULTIPLE_DATABASES=${POSTGRES_DEV_DB},${POSTGRES_TEST_DB}
    ports:
      - ${COURSESHINE_DB_PORT}:${COURSESHINE_DB_PORT}
    volumes:
      - courseshine_postgres_data:/var/lib/postgresql/data
      - ./courseshine_db:/dockerfile-entrypoint-initdb.d
    networks:
      - internal

  courseshine_pgadmin:
    container_name: courseshine_pgadmin
    image: dpage/pgadmin4:4.21
    restart: unless-stopped
    env_file: .env
    environment:
      - PGADMIN_DEFAULT_EMAIL=${POSTGRES_USER}
      - PGADMIN_DEFAULT_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - pgadmin:/var/lib/pgadmin
      - courseshine_postgres_data:/var/lib/postgresql/data
    depends_on:
      - courseshine_db
    networks:
      - internal

  courseshine_api: &api_base
    container_name: courseshine_api
    build:
      context: ../..
      dockerfile: courseshine_docker/development/courseshine_api/Dockerfile
    env_file: .env
    stdin_open: true
    volumes:
      - ../../courseshine_api:/var/www/courseshine/courseshine_api
      - /var/run/docker.sock:/var/run/docker.sock
      - bundle_cache:/usr/local/bundle
    depends_on:
      - courseshine_redis
      - courseshine_db
    networks:
      - internal

  courseshine_ui:
    container_name: courseshine_ui
    build:
      context: ../../
      dockerfile: courseshine_docker/development/courseshine_ui/Dockerfile
    env_file: .env
    stdin_open: true
    volumes:
      - ../../courseshine_ui:/var/www/courseshine_ui
    depends_on:
      - courseshine_api
    networks:
      - internal

networks:
  internal:
volumes:
  courseshine_redis_data:
  courseshine_postgres_data:
  pgadmin:
  bundle_cache:

我的courseshine\u api服务文档

FROM ruby:2.7.1-slim-buster

RUN apt-get update -qq && apt-get install -y build-essential nodejs  libpq-dev postgresql-client && rm -rf /var/lib/apt/lists/*

ENV APP_HOME /var/www/courseshine/courseshine_api

RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME

COPY ./courseshine_api/Gemfile $APP_HOME/Gemfile
COPY ./courseshine_api/Gemfile.lock $APP_HOME/Gemfile.lock
RUN bundle install --path vendor/cache
# Copy the main application.
COPY ./courseshine_api $APP_HOME 

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

# Expose port 3000 to the Docker host, so we can access it
# from the outside.
EXPOSE 3000

# The main command to run when the container starts. Also
# tell the Rails dev server to bind to all interfaces by
# default.
CMD ["rails","server","-b","0.0.0.0"]
entrypoint.sh

set-e

rm-f$APP_HOME/tmp/pids/server.pid

执行官“$@”


当我点击docker compose up时,courseshine_api服务不是stand and throw在任何源代码中都找不到rake-13.0.3(Bundler::GemNotFound)。出现此问题的原因以及如何解决此问题。

由于您使用
卷:
courseshine\u api
容器中的应用程序目录上装载代码,Dockerfile在该目录树中执行的任何操作都将丢失。尤其是映像中的
供应商/cache
目录被卷装载隐藏。删除特定的卷装载是否有帮助?不,它不起作用,相同的错误仍然存在。