How to put sidekiq into Docker in a rails application?

前端 未结 2 811
时光取名叫无心
时光取名叫无心 2021-02-04 12:30

I am using rails, sidekiq and docker.

My docker-compose.yml file

sidekiq:
  build: .
  command: bundle exec sidekiq -C config/sidekiq.yml
  links:
    -          


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 12:32

    Try to mount the volumes. Your docker-compose file should look like this (with PosgtreSQL as database) :

    web:
      build: .
      volumes:
        - .:/myapp
      links:
        - db
        - redis
      ports:
        - "3000:3000"
      command: bundle exec rails server -b 0.0.0.0
    sidekiq:
      build: .
      volumes:
        - .:/myapp
      links:
        - db
        - redis
      command: bundle exec sidekiq
    db:
      image: postgres
    redis:
      image: redis
    

提交回复
热议问题