Last active
March 9, 2018 12:14
-
-
Save rasmar/f47e968ba561902da45ed168695a8687 to your computer and use it in GitHub Desktop.
E2E - docker-compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' # Version of composer | |
services: | |
backend: # Backend container | |
build: | |
context: ~/backend # Backend should be pulled by git to this location | |
dockerfile: docker/Dockerfile.e2e # The location of Dockerfile, relative to context above | |
depends_on: # The containers below will be resolved and loaded before backed | |
- redis | |
- postgres | |
- frontend | |
- selenium | |
- elasticsearch | |
ports: | |
- "5001:5001" # Expose host_port:container_port | |
volumes: | |
- "/rspec_output:/app/rspec_output" # Mount /rspec_output (on host) to /app/rspec_output (in container) | |
environment: | |
- RAILS_ENV=e2e # This env var will be available to any container instance - used to run rspec in e2e env | |
- RAILS_MASTER_KEY # If no value is passed this var is going to be read from machine ENV - very useful. Just set RAILS_MASTER_KEY for secrets in CircleCI build config page | |
networks: # Virtual network for containers | |
main: # Name of the network | |
aliases: | |
- backend # Alias for reference purposes | |
command: bash -c "bash /app/docker/e2e.sh" # Start container by a bash script (container will be alive as long as this script is running) | |
frontend: # Frontend container | |
build: | |
context: . | |
dockerfile: Dockerfile.e2e | |
command: nginx | |
logging: # Disable spamming irrelevant messages from this container | |
driver: none | |
networks: | |
main: | |
aliases: | |
- frontend # Container name in virtual network that can be addressed | |
ports: | |
- "3000:3000" | |
volumes: # Used to mount ./tmp on machine to /app/dist in container | |
- "./tmp:/app/dist" | |
selenium: # Selenium container | |
image: selenium/standalone-chrome | |
ports: | |
- "4444:4444" | |
logging: # Disable spamming irrelevant messages from this container | |
driver: none | |
networks: | |
main: | |
aliases: | |
- selenium # Container name in virtual network that can be addressed | |
elasticsearch: # Elasticsearch container (not required) - we used it in project | |
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1 | |
volumes: | |
- "~/es_data:/usr/share/elasticsearch/data" | |
environment: | |
- "xpack.security.enabled=false" | |
- "transport.host=localhost" # This line might be needed to disable errors with circleCI 1.0 container memory amount | |
- "bootstrap.system_call_filter=false" # This line might be needed to disable errors with circleCI 1.0 container memory amount | |
ports: | |
- "9300:9300" | |
logging: # Disable spamming irrelevant messages from this container | |
driver: none | |
networks: | |
main: | |
aliases: | |
- elasticsearch # Container name in virtual network that can be addressed | |
postgres: # Postgres container | |
image: postgres:9.5 # Postgres version, installed from image on Docker Hub | |
environment: | |
- POSTGRES_PASSWORD=password # There can't be 'blank' password, use one specified in database.e2e.yml | |
logging: # Disable spamming irrelevant messages from this container | |
driver: none | |
networks: | |
main: | |
aliases: | |
- postgres # Container name in virtual network that can be addressed | |
redis: # Redis container | |
image: redis:4.0.6 # Redis version, installed from image on Docker Hub | |
logging: # Disable spamming irrelevant messages from this container | |
driver: none | |
networks: | |
main: | |
aliases: | |
- redis # Container name in virtual network that can be addressed | |
networks: # Set virtual network up | |
main: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment