Skip to content

Commit

Permalink
Combine web, worker and counter into a single container
Browse files Browse the repository at this point in the history
This is the recommended default Rails docker setup and it allows us to
add processes for CSS/JS bundling when we switch away from sprockets.
  • Loading branch information
pixeltrix committed Jan 8, 2025
1 parent af2fbbf commit 9579980
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ gem 'aws-sdk-codedeploy'
gem 'aws-sdk-cloudwatchlogs'
gem 'aws-sdk-s3'

group :development do
gem 'foreman'
end

group :development, :test do
gem 'simplecov'
gem 'brakeman', require: false
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ GEM
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
foreman (0.88.1)
globalid (1.2.1)
activesupport (>= 6.1)
hashdiff (1.1.1)
Expand Down Expand Up @@ -498,6 +499,7 @@ DEPENDENCIES
faker
faraday
faraday_middleware
foreman
image_processing
jbuilder
jquery-rails
Expand Down
3 changes: 3 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: bin/rails server -b 0.0.0.0 -p 3000
worker: MIN_PRIORITY=10 bin/rake jobs:work
counter: MAX_PRIORITY=5 bin/rake jobs:work
20 changes: 3 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,14 @@ services:
environment:
<<: *environment
command: [
"rails", "server",
"-b", "0.0.0.0",
"-p", "3000"
"foreman", "start",
"-f", "Procfile.dev"
]
ports:
- "127.0.0.1:3000:3000"
stdin_open: true
tty: true

worker:
<<: *application
environment:
<<: *environment
MIN_PRIORITY: "10"
command: [ "rake", "jobs:work" ]

counter:
<<: *application
environment:
<<: *environment
MAX_PRIORITY: "5"
command: [ "rake", "jobs:work" ]
init: true

volumes:
bundle:
Expand Down

0 comments on commit 9579980

Please sign in to comment.