Skip to content

Instantly share code, notes, and snippets.

@vojtasvoboda
Last active December 5, 2020 16:29
Show Gist options
  • Save vojtasvoboda/8d6259e28095d5c99216e5bf44b7d320 to your computer and use it in GitHub Desktop.
Save vojtasvoboda/8d6259e28095d5c99216e5bf44b7d320 to your computer and use it in GitHub Desktop.
GitLab CI FTP deploy with mwienk/docker-lftp docker image
stages:
- test
- deploy
cache:
paths:
- vendor
# test job
test:
stage: test
image: edbizarro/gitlab-ci-pipeline-php:7.1
script:
- sudo composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- vendor/bin/phpunit --configuration phpunit.xml
# upload job, see https://lftp.yar.ru/lftp-man.html
upload:
stage: deploy
image: mwienk/docker-lftp:latest
script:
- lftp -e "set ftp:ssl-allow false; mirror -eRnv app web/app; exit;" -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST
only:
- master
when: on_success
@arxeiss
Copy link

arxeiss commented Dec 5, 2020

I know this is old, but I had some troubles with mirror command. Because some FTP servers are not keeping the modify time from the source. But changing it to upload time. I was dealing with it by using another tool (FTP Deployment) to handle changes and LFTP just to do parallel upload.
If you are interested, I wrote an article about it here: https://dev.to/arxeiss/parallel-incremental-ftp-deploy-in-ci-pipeline-2511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment