Skip to content

Instantly share code, notes, and snippets.

@Sean-Bradley
Created April 2, 2019 06:35
Show Gist options
  • Save Sean-Bradley/15756234fff904e8d87415905887800e to your computer and use it in GitHub Desktop.
Save Sean-Bradley/15756234fff904e8d87415905887800e to your computer and use it in GitHub Desktop.
sample gitlab-ci.yml
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