Add docker image packaging stage.

This commit is contained in:
Spencer Ofwiti 2020-12-28 18:43:36 +03:00
parent 85d2f43b57
commit 06e141d519
1 changed files with 18 additions and 1 deletions

View File

@ -2,13 +2,14 @@ stages:
- install - install
- build - build
- test - test
- package
cache: cache:
key: key:
files: files:
- package-lock.json - package-lock.json
paths: paths:
- node_modules - node_modules/
policy: pull policy: pull
image: node:alpine image: node:alpine
@ -24,6 +25,7 @@ install_dependencies:
tags: tags:
- docker - docker
script: script:
- npm install -g @angular/cli@$CLI_VERSION
- npm install - npm install
only: only:
refs: refs:
@ -83,3 +85,18 @@ test:nglint:
- docker - docker
script: script:
- npm ng lint - npm ng lint
docker-build:
image: docker:latest
stage: package
services:
- docker:dind
only:
- master
before_script:
- echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER"
--password-stdin $CI_REGISTRY
script:
- IMAGE_NAME="$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
- docker build --pull -t "$IMAGE_NAME" -f Dockerfile .
- docker push "$IMAGE_NAME"