Skip to content

Instantly share code, notes, and snippets.

@r3cha
Last active August 16, 2024 09:02
Show Gist options
  • Save r3cha/6c4e8c999b65833820bb5b69b1f763e2 to your computer and use it in GitHub Desktop.
Save r3cha/6c4e8c999b65833820bb5b69b1f763e2 to your computer and use it in GitHub Desktop.
Docker compose
name: Initapp-rails
services:
app:
image: initapp-rails
build:
context: .
target: development
env_file:
- .docker.env
- .env
stdin_open: true
ports:
- ${PORT:-3000}:${PORT:-3000}
tmpfs:
- /app/tmp/pids
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./:/app:c
- cache:/app/tmp/cache:d
- bundle:/usr/local/bundle:d
- node_modules:/app/node_modules:d
- data:/data:d
healthcheck:
test: ["CMD", "curl", "http://app:3000/health"]
interval: 20s
timeout: 5s
retries: 3
start_period: 20s
command: bin/dev-start.sh
sidekiq:
image: initapp-rails
env_file: .docker.env
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
volumes:
- ./:/app:c
- cache:/app/tmp/cache:d
- bundle:/usr/local/bundle:d
- data:/data:d
command: bundle exec sidekiq -C config/sidekiq.yml
redis:
image: redis:7.4.0
volumes:
- redis:/data:delegated
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 3s
retries: 30
entrypoint: redis-server --appendonly yes
restart: always
postgres:
image: postgres:16.4-bullseye
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST: 0.0.0.0
volumes:
- postgres:/var/lib/postgresql/data:c
healthcheck:
test: ["CMD-SHELL", "pg_isready -h postgres -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# mailcatcher:
# image: dockage/mailcatcher
# container_name: initapp-mailcatcher
# restart: on-failure:10
# ports:
# - ${MAILCATCHER_PORT:-1080}:1080
volumes:
postgres:
redis:
bundle:
node_modules:
data:
cache:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment