Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # docker-compose.yml
- version: '2.1'
- services:
- app: &app
- build:
- context: .
- dockerfile: Dockerfile
- volumes: [".:/app"] # mount current directory into the image
- # use tmpfs for tmp and log for performance and to allow
- # multiple builds in parallel. Both directories are mounted
- # into the image AFTER the working directory is mounted.
- tmpfs: ["/app/tmp", "/app/log"]
- dev: &dev
- <<: *app
- env_file:
- - '.env'
- depends_on:
- postgres: {"condition":"service_healthy"}
- redis: {"condition":"service_healthy"}
- elasticsearch: {"condition":"service_healthy"}
- pgadmin: {"condition":"service_started"}
- sidekiq: {"condition":"service_started"}
- #webpacker: {"condition":"service_started"}
- networks:
- - rails
- server:
- <<: *dev
- command: ["bundle", "exec", "rails server -b 0.0.0.0 -p 80"]
- ports: ["80:80"]
- networks:
- - rails
- test: &test
- <<: *app
- environment:
- RAILS_ENV: "test"
- DATABASE_URL: postgresql://database_docker:pass@postgres:5432/database_docker?encoding=utf8&pool=5&timeout=5000"
- ELASTIC_SEARCH_URL: http://elasticsearch-test:9200
- REDIS_URL: "redis://redis-test"
- SPRING_TMP_PATH: "/app/tmp"
- # wait for all dependent services to be healthy
- depends_on:
- postgres-test: {"condition":"service_healthy"}
- redis-test: {"condition":"service_healthy"}
- elasticsearch-test: {"condition":"service_healthy"}
- webpacker: {"condition":"service_started"}
- # allow executing of single tests against a running spring server
- spring:
- <<: *test
- command: ["bundle", "exec", "./build/validate-migrated.sh && spring server"]
- elasticsearch: &elasticsearch
- image: elasticsearch:1.7.6
- ports: ["9200"]
- healthcheck:
- test: ["CMD", "curl", "-SsfL", "127.0.0.1:9200/_status"]
- interval: 1s
- timeout: 1s
- retries: 300
- networks:
- - rails
- elasticsearch-test:
- <<: *elasticsearch
- # place elasticsearch data on tmpfs for performance
- tmpfs: /usr/share/elasticsearch/data
- redis: &redis
- image: redis:2.8.23
- command: ["redis-server", "--requirepass yourpassword"]
- ports:
- - "6379:6379"
- healthcheck:
- test: ["CMD", "redis-cli", "ping"]
- interval: 1s
- timeout: 1s
- retries: 300
- networks:
- - rails
- redis-test:
- <<: *redis
- postgres: &postgres
- image: 'postgres:10.3-alpine'
- volumes:
- - '~/dev/docker_postgresdata:/usr/postgres/data'
- ports:
- - "5432:5432"
- env_file:
- - '.env'
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U postgres"]
- interval: 10s
- timeout: 5s
- retries: 5
- networks:
- - rails
- postgres-test:
- <<: *postgres
- tmpfs: /var/lib/postgres # place mysql on tmpfs for performance
- webpacker: &webpacker
- build: .
- env_file:
- - '.env'
- command: ["./bin/webpack-dev-server"]
- # volumes: [".:/webpacker-app"] # mount current directory into the image
- ports: ["3035:3035"]
- healthcheck:
- test: ["CMD", "true"]
- interval: 1s
- timeout: 1s
- retries: 300
- networks:
- - rails
- pgadmin:
- links:
- - postgres:postgres
- image: dpage/pgadmin4
- environment:
- PGADMIN_DEFAULT_EMAIL: "correo@dominio.org"
- PGADMIN_DEFAULT_PASSWORD: "pass"
- PGADMIN_LISTEN_PORT: "5050"
- ports:
- - "5050:80"
- restart: unless-stopped
- networks:
- - rails
- volumes:
- - ~/dev/data_pgadmin:/var/lib/pgadmin
- sidekiq: &sidekiq
- build: .
- env_file:
- - '.env'
- command: ["bundle", "exec", "sidekiq"]
- healthcheck:
- test: ["CMD", "true"]
- interval: 1s
- timeout: 1s
- retries: 300
- networks:
- - rails
- volumes:
- postgres:
- networks:
- rails:
- driver: bridge
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement