I'm taking a stab at doing an automatic deployment using GitLab's CI/CD.
My project has a couple dependencies managed through Composer and I read somewhere that these dependencies (vendor
directory) ideally should be added to the .gitignore
file so that they're not uploaded to the repository and that's what I did.
When I tested the automatic deployment, the modified files are getting uploaded but I received errors regarding missing vendor files which I expected - so now the question is how do I install these dependencies in the context of the remote server from the GitLab CI/CD environment?
My .gitlab-ci.yml
file looks like this:
staging:
stage: staging
before_script:
- apt-get update -qq && apt-get install -y -qq lftp
script:
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rev . /public_html --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
environment:
name: staging
url: http://staging.example.com
only:
- staging