#Docker image for Bitbucket Pipeline deployments via rsync.
WARNING
Deletes files not in repo unless it's been added to
.gitignoreor you've added it tobitbucket-pipelines-exclude.txtfileThe example below passed the
--deleteflag, if you're not deploying to a webroot, such as, your project contains a webroot and is deployed in a folder with shared system files this option could blow things up.If you're migrating over from
fabdeployyou need to create a bitbucket-pipelines-exclude.txt file from theignore_listfound in fabfile.json.using a root user and needing
www-dataas the user and groupdReplace the flag
-pthrvzwith-pogthrvzif you need to change the user/group before deploying; addchown www-data:www-data ./ -Rbefore the rsync stepHeads-up
find . -type f -name "*.php" -exec chmod 700 {} \;maybe too strict if you've not changed the user.
image: tombras/rsync
pipelines:
branches:
master:
- step:
deployment: test
script:
- find . -type d -exec chmod 755 {} \;
- find . -type f -exec chmod 644 {} \;
# strict/secure permissions for php
- find . -type f -name "*.php" -exec chmod 700 {} \;
- sshpass -p $RSYNC_PASSWORD rsync -pthrvz --delete --exclude='.git/' --exclude-from='.gitignore' --exclude-from='bitbucket-pipelines-exclude.txt' ./ <USER>@<HOSTNAME>:<DIR_NAME>
- step:
deployment: staging
trigger: manual
script:
- find . -type d -exec chmod 755 {} \;
- find . -type f -exec chmod 644 {} \;
# strict/secure permissions for php
- find . -type f -name "*.php" -exec chmod 700 {} \;
- sshpass -p $RSYNC_PASSWORD rsync -pthrvz --delete --exclude='.git/' --exclude-from='.gitignore' --exclude-from='bitbucket-pipelines-exclude.txt' ./ <USER>@<HOSTNAME>:<DIR_NAME>
- step:
deployment: production
trigger: manual
script:
- find . -type d -exec chmod 755 {} \;
- find . -type f -exec chmod 644 {} \;
# strict/secure permissions for php
- find . -type f -name "*.php" -exec chmod 700 {} \;
- sshpass -p $RSYNC_PASSWORD rsync -pthrvz --delete --exclude='.git/' --exclude-from='.gitignore' --exclude-from='bitbucket-pipelines-exclude.txt' ./ <USER>@<HOSTNAME>:<DIR_NAME>
Content type
Image
Digest
Size
71.6 MB
Last updated
about 8 years ago
docker pull tombras/rsync