jackbrycesmith / laravel-caprover-template

Template to deploy a Laravel app in docker for CapRover
MIT License
127 stars 44 forks source link

GitLab CI/CD Deployment #18

Open mrlinnth opened 2 years ago

mrlinnth commented 2 years ago

Not really an issue. Just seeking advice and guidance.

I just found and learned to use CapRover today. Your template helped and I have successfully deployed my laravel app to my server. My repo is on GitLab and I'm currently using webhook for auto deployment.

I would like to use GitLab CI/CD for the deployment instead of webhook. How can I set up CI/CD with this template?

I have read the CapRover docs for CICD but I am not very clear. It says to just use Docker file, so should I delete captain-definiton file and move Docker out of .deploy folder? And do I have to update the variables in the Docker file or just use as it is?

I'm noob at docker and all this. Any help is appreciated.

ezra-obiwale commented 2 years ago

@mrlinnth Here's a stripped-down version of the ci/cd config I use

# THE FOLLOWING VARIABLES MUST BE CONFIGURED AS CI/CD VARIABLES
#
# - CAPROVER_URL
# - CAPROVER_PASSWORD

variables:
  APP_NAME: YourAwesomeApp
  CAPROVER_APP: your-awesome-app
  APP_URL: https://www.awesome-app.com
  DOCKER_DRIVER: overlay2

deploy:
  image: node:14.3-alpine
  environment:
    name: production
    url: $APP_URL
  only:
    - master
  script:
    - tar -cvf ./deploy.tar ./*
    - npm i -g caprover
    - caprover deploy -t ./deploy.tar -a $CAPROVER_APP

Hope this helps.