Skip to content

Instantly share code, notes, and snippets.

@zoka123
Created May 17, 2019 07:51
Show Gist options
  • Save zoka123/f880b45eaf0fb7a347b961759dfb79c3 to your computer and use it in GitHub Desktop.
Save zoka123/f880b45eaf0fb7a347b961759dfb79c3 to your computer and use it in GitHub Desktop.
Docker-sync example
version: '3.6'
services:
php:
image: php
build:
context: services/php
args:
USER_ID: 1000
volumes:
- sync-name:/var/www
...
version: '2'
options:
verbose: true
syncs:
sync-name:
src: '.'
sync_strategy: 'unison'
sync_excludes: ['.idea', '.git', 'var/cache', 'var/log']
sync_userid: '1000'
watch_excludes: ['.*/.git', '.gitignore', 'var/cache', 'var/log']
This is how I use docker-sync to get better performance with Symfony apps.
The performance increase is visible to me in both response time and test execution time.
1. Install docker-sync
2. Create docker-sync configuration in the project directory.
3. Map sync name as a volume in your docker-compose.yml
4. Start docker-sync with `docker-sync start -f` and check console for errors
5. Start docker-compose
6. Attach to the container and see your files there
If something breaks with the sync, there will be a bunch of files with `*conflict*` suffix.
I usually just delete them and restart the sync with `CTRL+C (to break the process in the foreground)`
and then `docker-sync stop && docker-sync clean`
Hope it works for you :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment