Skip to content

Instantly share code, notes, and snippets.

@dantleech
Last active August 10, 2017 08:26
Show Gist options
  • Save dantleech/a2520e618640b3d1158215e6aa13ef95 to your computer and use it in GitHub Desktop.
Save dantleech/a2520e618640b3d1158215e6aa13ef95 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run a command in the app container as the www-data user
ARGS="$@"
docker exec --user=www-data --tty=true `docker-compose ps -q app` $ARGS
#!/bin/bash
# Sync all changes to the app container
while RES=$(inotifywait -r -e close_write ./ --format %w%f)
do
echo 'FILE: '$RES
rsync \
-azrlptDv \
--chown=www-data:www-data \
--force \
--blocking-io \
--progress \
--relative \
--exclude=4913 \
-e "docker exec -i "`docker-compose ps -q app` \
./$RES \
env:/app
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment