Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.17 KiB
Newer Older
Ulf Seltmann's avatar
Ulf Seltmann committed
stages:
- build_app
- test_app
- publish_app
- build_image
- publish_image

variables:
  npm_config_registry: https://docker.ub.intern.uni-leipzig.de/npm

npm_install:
  stage: build_app
  image: node:8-alpine
  script:
  - npm install
  - npm run build
  cache:
    key: "${CI_COMMIT_SHA}"
    paths:
    - node_modules
    - dist
    - public
  tags:
    - docker

npm_ci:
  stage: test_app
  image: node:8-alpine
  script:
  - npm run ci
  cache:
    key: "${CI_COMMIT_SHA}"
    paths:
    - dist
    - public
  tags:
    - docker

Ulf Seltmann's avatar
Ulf Seltmann committed
  stage: publish_app
  only:
  - master
  image: node:8-alpine
  script:
Ulf Seltmann's avatar
Ulf Seltmann committed
  cache:
    key: "${CI_COMMIT_SHA}"
    paths:
Ulf Seltmann's avatar
Ulf Seltmann committed
  tags:
    - docker

docker_build:
  stage: build_image
  only:
  - master
  image: docker:latest
  services:
  - docker:dind
  script:
  - docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD}
  - docker build --no-cache --pull -t bdddev/dacap:latest .
Ulf Seltmann's avatar
Ulf Seltmann committed
  - docker tag bdddev/dacap:latest bdddev/dacap:${CI_PIPELINE_ID}
  - docker push bdddev/dacap:${CI_PIPELINE_ID}
  - docker push bdddev/dacap:latest
Ulf Seltmann's avatar
Ulf Seltmann committed
  cache:
    key: "${CI_COMMIT_SHA}"
    paths:
    - "*.tgz"
Ulf Seltmann's avatar
Ulf Seltmann committed
  tags:
    - docker