hoangweb
4/18/2016 - 2:28 PM

docker-compose.yml

docker-compose.yml

version: '2'
services:       #since version 2
    web:
      build: .
      depends_on:
        - db
        - redis
    
    ghost:
      image: ghost:latest
      ports:
        - 5000:5000
      volumes:
        # Just specify a path and let the Engine create a volume
        - /var/lib/mysql
        
        # Specify an absolute path mapping
        - /opt/data:/var/lib/mysql
        
        # Path on the host, relative to the Compose file
        - ./cache:/tmp/cache
        
        # User-relative path
        - ~/configs:/etc/configs/:ro        # (ro=read only, rw = read write ->default)
        
        # Named volume
        - datavolume:/var/lib/mysql
          
        - .:/ghost
        - /dir1:/data
    
      volumes_from:
        - paasdata
        
      environment:
        URL: http://localhost:5000      
        - DB_USER=root  #or
        DB_PASS: ghost
        S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID}
        S3_ACCESS_KEY: ${S3_ACCESS_KEY}
      
      # Add environment variables from a file
      env_file:     #paths in env_file are relative to the directory that file is in: 
        - ./common.env      #VAR=VAL separate in line
        - ./apps/web.env
        - /opt/secrets.env
      
      links:
        - db
        
      depends_on:   # run redis at first
        - db
        - redis
      
      command: php -S 0.0.0.0:8000 -t /code/wordpress/
      
      expose:
        - "3000"
        - "8000"
      
      # Override the default entrypoint.
      entrypoint: /code/entrypoint.sh
      
    db:
      image: percona
      ports:
       - "3306:3306"
      environment:
        MYSQL_ROOT_PASSWORD: ghost
        MYSQL_DATABASE: ghost
      command: tail -f /dev/null
      
    paasdata:
      image: oskarhane/data
      command: tail -f /dev/null
      
    
    redis:
      image: redis