Add docker image packaging stage.

This commit is contained in:
Spencer Ofwiti 2020-12-28 18:43:36 +03:00
parent 85d2f43b57
commit 06e141d519

View File

@ -2,13 +2,14 @@ stages:
- install
- build
- test
- package
cache:
key:
files:
- package-lock.json
paths:
- node_modules
- node_modules/
policy: pull
image: node:alpine
@ -24,6 +25,7 @@ install_dependencies:
tags:
- docker
script:
- npm install -g @angular/cli@$CLI_VERSION
- npm install
only:
refs:
@ -83,3 +85,18 @@ test:nglint:
- docker
script:
- 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"