Skip to content

Instantly share code, notes, and snippets.

@peschee
Created December 26, 2019 10:34
Show Gist options
  • Save peschee/aa574d9516cf098743397d9fd4a43138 to your computer and use it in GitHub Desktop.
Save peschee/aa574d9516cf098743397d9fd4a43138 to your computer and use it in GitHub Desktop.
Gitlab CI Example
stages:
- build
- deploy
build:
stage: build
image: node:dubnium
variables:
CI: "true"
script:
- npm i
- npm run build -- --output-path dist --configuration develop --base-href /app/$APP_NAME-$CI_COMMIT_REF_SLUG/
artifacts:
paths:
- dist/
expire_in: '1 hour'
cache:
paths:
- node_modules/
only:
- develop
- /^feature\/.*$/
- /^hotfix\/.*$/
tags:
- docker
deploy:
stage: deploy
dependencies:
- build
artifacts:
paths:
- dist/
script:
- docker-compose -p $APP_NAME-$CI_COMMIT_REF_SLUG up -d --build
environment:
name: review/$CI_COMMIT_REF_NAME
on_stop: undeploy
only:
- develop
- /^feature\/.*$/
- /^hotfix\/.*$/
tags:
- deploy
undeploy:
stage: deploy
script:
- docker-compose -p $APP_NAME-$CI_COMMIT_REF_SLUG down
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
when: manual
only:
- /^feature\/.*$/
- /^hotfix\/.*$/
tags:
- deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment