version: "2.1" services: hs_application: image: hs_application:latest depends_on: mysql_db: condition: service_healthy volumes: - .:/home/node/app/ - /home/node/app/node_modules ports: - "${PORT}:${PORT}" networks: - internal - hacker_suite mysql_db: container_name: mysql_db image: mysql:5.7 command: --default-authentication-plugin=mysql_native_password --log_error_verbosity=1 environment: MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} # The healthcheck is used to ensure the database is running before hs_application starts healthcheck: test: ["CMD-SHELL", "mysqladmin ping -h localhost --silent"] timeout: 5s retries: 10 ports: - "${DB_PORT}:3306" networks: - internal_hackathon volumes: - db_store:/var/lib/mysql # The volume for the database is persistent across launches volumes: db_store: # The network allows multiple containers to connect together networks: # internal network for hs_applications services internal: driver: bridge internal_hackathon: driver: bridge # external network for consumer-facing hacker suite services hacker_suite: external: name: hacker_suite