Skip to content

Instantly share code, notes, and snippets.

@kelchm
Created June 23, 2017 13:42
Show Gist options
  • Save kelchm/fc8ca06dd3e44a42fa640ed7a8e8429e to your computer and use it in GitHub Desktop.
Save kelchm/fc8ca06dd3e44a42fa640ed7a8e8429e to your computer and use it in GitHub Desktop.
variables:
COMPOSE_FILE: "docker-compose.rancher.yml"
TRAEFIK_ENABLED: "true"
STACK_NAME: $CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG
stages:
- build
- deploy
- cleanup
build:
stage: build
script:
- build
deploy_devevelopment:
stage: deploy
variables:
RANCHER_ENVIRONMENT: development
script:
- deploy
environment:
name: development/$CI_COMMIT_REF_SLUG
url: http://web.$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG.$RANCHER_ENVIRONMENT.$RANCHER_FQDN
on_stop: stop_development
only:
- branches
except:
- master
stop_development:
stage: cleanup
variables:
RANCHER_ENVIRONMENT: development
script:
- destroy
environment:
name: development/$CI_COMMIT_REF_SLUG
action: stop
when: manual
only:
- branches
except:
- master
deploy_staging:
stage: deploy
variables:
RANCHER_ENVIRONMENT: staging
STACK_NAME: $CI_PROJECT_NAME
script:
- deploy
environment:
name: staging
url: http://web.$CI_PROJECT_NAME.$RANCHER_ENVIRONMENT.$RANCHER_FQDN
only:
- master
deploy_production:
stage: deploy
variables:
RANCHER_ENVIRONMENT: production
STACK_NAME: $CI_PROJECT_NAME
script:
- deploy
environment:
name: production
url: http://web.$CI_PROJECT_NAME.$RANCHER_ENVIRONMENT.$RANCHER_FQDN
when: manual
only:
- /^v.*$/
except:
- branches
- triggers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment