Skip to content

Instantly share code, notes, and snippets.

@vovimayhem
Created February 25, 2019 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vovimayhem/5f6eb5e993a503a9472fa00b1fbbded0 to your computer and use it in GitHub Desktop.
Save vovimayhem/5f6eb5e993a503a9472fa00b1fbbded0 to your computer and use it in GitHub Desktop.
Ejemplo de Sidekiq + Docker
version: "2.4"
volumes:
postgres_data:
redis_data:
rabbit_data:
networks:
backend:
services:
postgres:
image: postgres:9-alpine
ports:
# We'll bind our (configurable) host's port 5432 to postgres's port 5432, so
# we can use our database IDEs with it:
- ${EXAMPLE_PG_PORT:-5432}:5432
volumes:
# Mount the postgres data volume
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: 3x4mpl3P455w0rd
redis:
image: redis:3-alpine
ports:
- ${EXAMPLE_REDIS_PORT:-6379}:6379
volumes:
- redis_data:/data
networks: [ "backend" ]
command: redis-server --appendonly yes
version: '2.4'
volumes:
postgres_data:
redis_data:
web_ui_node_modules: # See comment below on 'web' service's volumes
networks:
backend:
frontend:
services:
postgres:
extends:
file: common-services.yml
service: postgres
redis:
extends:
file: common-services.yml
service: redis
test: &app_test
build:
context: .
dockerfile: Dockerfile
target: development
args:
- DEVELOPER_USER=${USER:-you}
- DEVELOPER_UID=${UID:-1000}
image: vovimayhem/example-app:development
entrypoint: /usr/src/bin/dev-entrypoint.sh
volumes:
- ./artanis:/usr/src
stdin_open: true
tty: true
command: guard
networks: [ "backend" ]
depends_on: [ "postgres", "redis" ]
environment: &app_test_env
DATABASE_URL: postgres://postgres:3x4mpl3P455w0rd@postgres:5432/example_test
REDIS_URL: redis://redis:6379/0
RAILS_ENV: test
RACK_ENV: test
RAILS_LOG_TO_STDOUT: "true"
worker: &app
<<: *app_test
command: sidekiq -c 1
environment: &app_env
<<: *app_test_env
DATABASE_URL: postgres://postgres:3x4mpl3P455w0rd@postgres:5432/example_development
REDIS_URL: redis://redis:6379/1
RAILS_ENV: development
RACK_ENV: development
web:
<<: *app
command: rails server -p 3000 -b 0.0.0.0
ports:
- ${EXAMPLE_WEB_PORT:-3000}:3000
networks: [ "backend", "frontend" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment