i’m trying to add sidekiq to an existing docker-compose file (which runs fine) but as soon as I do it complains it cannot find the dockerfile. I’ve tried all sorts of variations in the build: section but can’t for the life of me get this to work correctly.
I’m running in portainer and the exact error is : failed to deploy a stack: failed to solve: failed to read dockerfile: open Dockerfile: no such file or directory.
Removing the nginx service from docker-compose does remove the error (just to confirm it works without)
Dockerfile
FROM ruby:3.3.0
# Directory where the app will be installed on the container
WORKDIR /app
# Install NodeJS 18 repository
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
# Update the system and install NodeJS
RUN apt-get update && apt-get -y install
nodejs
vim
&& rm -rf /var/lib/apt/lists/*
# Install ruby gems
COPY Gemfile Gemfile.lock ./
RUN bundle install
# Run `npm install`
COPY package.json package-lock.json ./
RUN npm install
# Copy the application file to the container
COPY . .
# temp secret key base
ENV SECRET_KEY_BASE_DUMMY="1"
# Pre-compile assets for production
RUN RAILS_ENV=production bundle exec rails assets:precompile
docker-compose.yml
services:
app:
build: .
command: bundle exec rails s -p 3000 -e production -b '0.0.0.0'
image: my/image:latest
ports:
- 3000:3000
environment:
- DB_HOST=db
- DB_USERNAME=postgres
- DB_PASSWORD=postgres
- RAILS_ENV=production
- RAILS_SERVE_STATIC_FILES=true
- RAILS_LOG_TO_STDOUT=true
- RAILS_MASTER_KEY=my_ultra_top_secret_master_key!!
- JOB_WORKER_URL=redis://redis:6379/0
depends_on:
- db
- redis
sidekiq:
build: .
command: bundle exec rails sidekiq -e production
links:
- db
- redis
depends_on:
- db
- redis
db:
image: postgres:14
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- postgres:/var/lib/postgresql/data
redis:
image: redis:6.2-alpine
command: redis-server
volumes:
- redis:/data
ports:
- 6379
logging:
driver: none
volumes:
postgres:
bundle:
redis: