Publish Docker image for each master commit on local registry

This commit is contained in:
timvisee 2020-10-15 19:16:49 +02:00
parent dd9d6c1660
commit c6cab13e6a
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
1 changed files with 18 additions and 0 deletions

View File

@ -2,6 +2,7 @@ image: "node:12-slim"
stages: stages:
- test - test
- package
before_script: before_script:
# Install dependencies # Install dependencies
@ -21,3 +22,20 @@ test:
- npm ci - npm ci
- npm run lint - npm run lint
- npm test - npm test
package-docker:
stage: package
image: docker:latest
services:
- docker:dind
only:
- master
script:
- export IMG_NAME=registry.gitlab.com/timvisee/send:master-$CI_COMMIT_SHA
# Login in to registry
- 'docker login registry.gitlab.com -u $DOCKER_USER -p $DOCKER_PASS'
# build and push image
- docker build -t $IMG_NAME .
- docker push $IMG_NAME