Created
April 2, 2019 06:35
-
-
Save Sean-Bradley/15756234fff904e8d87415905887800e to your computer and use it in GitHub Desktop.
sample gitlab-ci.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: docker:latest | |
services: | |
- docker:dind | |
stages: | |
- test | |
- deploy | |
step-develop: | |
stage: test | |
before_script: | |
- export DYNAMIC_ENV_VAR=DEVELOP | |
only: | |
- develop | |
tags: | |
- develop | |
script: | |
- echo running tests in $DYNAMIC_ENV_VAR | |
step-uat: | |
stage: deploy | |
before_script: | |
- export DYNAMIC_ENV_VAR=UAT | |
only: | |
- uat | |
tags: | |
- uat | |
script: | |
- echo setting up env $DYNAMIC_ENV_VAR | |
- sudo apt-get install -y python-pip | |
- sudo pip install docker-compose | |
- sudo docker image prune -f | |
- sudo docker-compose -f docker-compose.yml build --no-cache | |
- sudo docker-compose -f docker-compose.yml up -d | |
step-deploy-staging: | |
stage: deploy | |
before_script: | |
- export DYNAMIC_ENV_VAR=STAGING | |
only: | |
- staging | |
tags: | |
- staging | |
script: | |
- echo setting up env $DYNAMIC_ENV_VAR | |
- sudo apt-get install -y python-pip | |
- sudo pip install docker-compose | |
- sudo docker image prune -f | |
- sudo docker-compose -f docker-compose.yml build --no-cache | |
- sudo docker-compose -f docker-compose.yml up -d | |
step-deploy-production: | |
stage: deploy | |
before_script: | |
- export DYNAMIC_ENV_VAR=PRODUCTION | |
only: | |
- production | |
tags: | |
- production | |
script: | |
- echo setting up env $DYNAMIC_ENV_VAR | |
- sudo apt-get install -y python-pip | |
- sudo pip install docker-compose | |
- sudo docker image prune -f | |
- sudo docker-compose -f docker-compose.yml build --no-cache | |
- sudo docker-compose -f docker-compose.yml up -d | |
when: manual | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment