Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. # docker-compose.yml
  2. version: '2.1'
  3.  
  4. services:
  5. app: &app
  6. build:
  7. context: .
  8. dockerfile: Dockerfile
  9. volumes: [".:/app"] # mount current directory into the image
  10.  
  11. # use tmpfs for tmp and log for performance and to allow
  12. # multiple builds in parallel. Both directories are mounted
  13. # into the image AFTER the working directory is mounted.
  14. tmpfs: ["/app/tmp", "/app/log"]
  15.  
  16. dev: &dev
  17. <<: *app
  18. env_file:
  19. - '.env'
  20. depends_on:
  21. postgres: {"condition":"service_healthy"}
  22. redis: {"condition":"service_healthy"}
  23. elasticsearch: {"condition":"service_healthy"}
  24. pgadmin: {"condition":"service_started"}
  25. sidekiq: {"condition":"service_started"}
  26. #webpacker: {"condition":"service_started"}
  27. networks:
  28. - rails
  29.  
  30.  
  31. server:
  32. <<: *dev
  33. command: ["bundle", "exec", "rails server -b 0.0.0.0 -p 80"]
  34. ports: ["80:80"]
  35. networks:
  36. - rails
  37.  
  38. test: &test
  39. <<: *app
  40.  
  41. environment:
  42. RAILS_ENV: "test"
  43. DATABASE_URL: postgresql://database_docker:pass@postgres:5432/database_docker?encoding=utf8&pool=5&timeout=5000"
  44. ELASTIC_SEARCH_URL: http://elasticsearch-test:9200
  45. REDIS_URL: "redis://redis-test"
  46. SPRING_TMP_PATH: "/app/tmp"
  47.  
  48. # wait for all dependent services to be healthy
  49. depends_on:
  50. postgres-test: {"condition":"service_healthy"}
  51. redis-test: {"condition":"service_healthy"}
  52. elasticsearch-test: {"condition":"service_healthy"}
  53. webpacker: {"condition":"service_started"}
  54.  
  55. # allow executing of single tests against a running spring server
  56. spring:
  57. <<: *test
  58. command: ["bundle", "exec", "./build/validate-migrated.sh && spring server"]
  59.  
  60.  
  61. elasticsearch: &elasticsearch
  62. image: elasticsearch:1.7.6
  63. ports: ["9200"]
  64. healthcheck:
  65. test: ["CMD", "curl", "-SsfL", "127.0.0.1:9200/_status"]
  66. interval: 1s
  67. timeout: 1s
  68. retries: 300
  69. networks:
  70. - rails
  71.  
  72. elasticsearch-test:
  73. <<: *elasticsearch
  74. # place elasticsearch data on tmpfs for performance
  75. tmpfs: /usr/share/elasticsearch/data
  76.  
  77. redis: &redis
  78. image: redis:2.8.23
  79. command: ["redis-server", "--requirepass yourpassword"]
  80. ports:
  81. - "6379:6379"
  82. healthcheck:
  83. test: ["CMD", "redis-cli", "ping"]
  84. interval: 1s
  85. timeout: 1s
  86. retries: 300
  87. networks:
  88. - rails
  89.  
  90. redis-test:
  91. <<: *redis
  92.  
  93. postgres: &postgres
  94. image: 'postgres:10.3-alpine'
  95. volumes:
  96. - '~/dev/docker_postgresdata:/usr/postgres/data'
  97. ports:
  98. - "5432:5432"
  99. env_file:
  100. - '.env'
  101. healthcheck:
  102. test: ["CMD-SHELL", "pg_isready -U postgres"]
  103. interval: 10s
  104. timeout: 5s
  105. retries: 5
  106. networks:
  107. - rails
  108.  
  109. postgres-test:
  110. <<: *postgres
  111. tmpfs: /var/lib/postgres # place mysql on tmpfs for performance
  112.  
  113. webpacker: &webpacker
  114. build: .
  115. env_file:
  116. - '.env'
  117. command: ["./bin/webpack-dev-server"]
  118. # volumes: [".:/webpacker-app"] # mount current directory into the image
  119. ports: ["3035:3035"]
  120. healthcheck:
  121. test: ["CMD", "true"]
  122. interval: 1s
  123. timeout: 1s
  124. retries: 300
  125. networks:
  126. - rails
  127. pgadmin:
  128. links:
  129. - postgres:postgres
  130. image: dpage/pgadmin4
  131. environment:
  132. PGADMIN_DEFAULT_EMAIL: "correo@dominio.org"
  133. PGADMIN_DEFAULT_PASSWORD: "pass"
  134. PGADMIN_LISTEN_PORT: "5050"
  135. ports:
  136. - "5050:80"
  137. restart: unless-stopped
  138. networks:
  139. - rails
  140. volumes:
  141. - ~/dev/data_pgadmin:/var/lib/pgadmin
  142. sidekiq: &sidekiq
  143. build: .
  144. env_file:
  145. - '.env'
  146. command: ["bundle", "exec", "sidekiq"]
  147. healthcheck:
  148. test: ["CMD", "true"]
  149. interval: 1s
  150. timeout: 1s
  151. retries: 300
  152. networks:
  153. - rails
  154.  
  155. volumes:
  156. postgres:
  157.  
  158. networks:
  159. rails:
  160. driver: bridge
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement