Skip to content

Instantly share code, notes, and snippets.

@tomasfejfar
Created April 3, 2018 11:35
Show Gist options
  • Save tomasfejfar/ba643d6434e596735b55e7255486202a to your computer and use it in GitHub Desktop.
Save tomasfejfar/ba643d6434e596735b55e7255486202a to your computer and use it in GitHub Desktop.
Using YAML to reuse parts of existing docker-compose configuration
version: "3"
services:
apache: &apacheConfig
build: .
volumes:
- ./:/var/www/html:cached
- ./docker/php-apache/php.ini:/usr/local/etc/php/php.ini
- ./docker/php-apache/ssl-local:/etc/httpd/ssl
working_dir: /var/www/html
ports:
- "8700:443"
- "8800:80"
links:
- elasticsearch
apache-xdebug:
<<: *apacheConfig
build: docker/xdebug
volumes:
- ./:/var/www/html:cached
- ./docker/php-apache/php.ini:/usr/local/etc/php/php.ini
- ./docker/php-apache/ssl-local:/etc/httpd/ssl
- ./docker/xdebug/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
@pierreabreup
Copy link

A variation of this:

api:
    environment: &app-variable-environments
      - FS_AWS_S3_ACCESS_KEY_ID
      - FS_AWS_S3_SECRET_ACCESS_KEY
      - FS_AWS_S3_REGION
      - FS_AWS_S3_BUCKET
      - MONGO_URL
      - MONGO_DB
      - REDIS_HOST
      - REDIS_PORT
      - REDIS_DB
      - UI_PORT
      - API_PORT
      - DOMAIN_NAME
      - APP_SECRET
      - SMTP_HOST
      - SMTP_PORT
      - SMTP_SECURED
      - SMTP_USER
      - SMTP_PASS
    build:
      context: ./app

worker:
    environment: *app-variable-environments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment