| 1234567891011121314151617181920212223 |
- #!/usr/bin/env bash
- [ $# -eq 0 ] && echo "Please specify one or more directories/files to copy to container (ex. vendor, --all)" && exit 1
- REAL_SRC=$(cd -P "src" >/dev/null && pwd)
- CONTAINER_ID=$(bin/docker-compose ps -q phpfpm | awk '{print $1}')
- for ARG in "$@"; do
- if [ "$ARG" == "--all" ]; then
- docker cp "$REAL_SRC/./" "$CONTAINER_ID":/var/www/html/
- echo "Completed copying all files from host to container"
- bin/fixowns
- bin/fixperms
- else
- if [ -f "$REAL_SRC/$ARG" ]; then
- docker cp "$REAL_SRC/$ARG" "$CONTAINER_ID":/var/www/html/"$ARG"
- else
- docker cp "$REAL_SRC/$ARG" "$CONTAINER_ID":/var/www/html/"$(dirname "$ARG")"
- fi
- echo "Completed copying $ARG from host to container"
- bin/fixowns "$ARG"
- bin/fixperms "$ARG"
- fi
- done
|