Skip to content

Instantly share code, notes, and snippets.

@alle
Forked from chriswales95/docker-compose.yml
Created September 9, 2020 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alle/0fa7fdf9936fc4e43adce12dd596ebfc to your computer and use it in GitHub Desktop.
Save alle/0fa7fdf9936fc4e43adce12dd596ebfc to your computer and use it in GitHub Desktop.
Mutagen compose example
version: "3.7"
services:
drupal:
depends_on:
- db
build: ./app
restart: unless-stopped
volumes:
- code:/app # mount the mutagen volume
environment:
COMPOSER_MEMORY_LIMIT: -1
db:
image: mysql:8.0
env_file:
- ./docker.env
restart: unless-stopped
stop_grace_period: 30s
# declare our volume
volumes:
code:
x-mutagen:
sync:
drupal:
# https://mutagen.io/documentation/synchronization
alpha: "./app" # local file system
beta: "volume://code/app" # container file system. Notice I don't mount the root of the volume itself.
mode: "two-way-safe" #https://mutagen.io/documentation/synchronization
ignore:
vcs: true # exclude version control
paths: # exclude the junk we don't need from being synced
- "*/node_modules/"
- "*/vendor/"
# permissions get kind of screwed up inside the container when mounting hence why the beta directory is 1 folder deep. This helps get around permissions issues.
configurationBeta:
permissions:
defaultFileMode: 0666
defaultDirectoryMode: 0777
# This kind of replaces the standard port forwarding. Pretty much works the same as normal forwardin and the old way still works.
forward:
drupal:
source: "tcp:localhost:8080"
destination: "network://default:tcp:drupal:80"
db:
source: "tcp:localhost:3306"
destination: "network://default:tcp:db:3306"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment