copytocontainer 542 B

123456789101112131415
  1. #!/bin/bash
  2. [ -z "$1" ] && echo "Please specify a directory or file to copy to container (ex. vendor, --all)" && exit
  3. REAL_SRC=$(cd -P "src" && pwd)
  4. if [ "$1" == "--all" ]; then
  5. docker cp $REAL_SRC/./ $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/
  6. echo "Completed copying all files from host to container"
  7. bin/fixowns
  8. bin/fixperms
  9. else
  10. docker cp $REAL_SRC/$1 $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/$1
  11. echo "Completed copying $1 from host to container"
  12. bin/fixowns $1
  13. bin/fixperms $1
  14. fi