cweagans / docker-bg-sync

A container that syncs files between two configurable directories.
224 stars 39 forks source link

Exclusions #4

Closed Harrisonbro closed 7 years ago

Harrisonbro commented 7 years ago

Is there a way to exclude certain files or folders from being synced? I'm thinking specifically of my .git directory which doesn't need to be synced into the container.

wvteijlingen commented 7 years ago

FYI, you can use the SYNC_EXTRA_UNISON_PROFILE_OPTS environment variable for this. For example:

bg-sync:
    image: cweagans/bg-sync
    volumes:
      - .:/source
    volumes_from:
      - web
    environment:
      SYNC_EXTRA_UNISON_PROFILE_OPTS: |
        ignore = Path tmp/*
        ignore = Path .ebextensions/*
        ignore = Path .elasticbeanstalk/*
Harrisonbro commented 7 years ago

Great idea, thank you.

cweagans commented 7 years ago

Note that .git is not synced by default (https://github.com/cweagans/docker-bg-sync/blob/master/sync.sh#L140-L143). If there are other things you need to ignore, the solution from @wvteijlingen is probably the correct one.