Skip to content

Instantly share code, notes, and snippets.

@philipz
Created January 31, 2017 13:36
Show Gist options
  • Save philipz/dcea7aeb7081b3bc94ca569f123a04f6 to your computer and use it in GitHub Desktop.
Save philipz/dcea7aeb7081b3bc94ca569f123a04f6 to your computer and use it in GitHub Desktop.
Using Docker --cache-form
image: docker:latest
services:
- docker:dind
stages:
- build
- test
- release
variables:
CONTAINER_IMAGE: registry.anuary.com/$CI_PROJECT_PATH
DOCKER_DRIVER: overlay2
build:
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.anuary.com
- docker build --cache-from $CONTAINER_IMAGE:latest --build-arg NPM_TOKEN=${NPM_TOKEN} -t $CONTAINER_IMAGE:$CI_BUILD_REF -t $CONTAINER_IMAGE:latest .
- docker push $CONTAINER_IMAGE:$CI_BUILD_REF
- docker push $CONTAINER_IMAGE:latest
test:
stage: test
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.anuary.com
- docker pull $CONTAINER_IMAGE:$CI_BUILD_REF
- docker run $CONTAINER_IMAGE:$CI_BUILD_REF npm run test
release:
image: node:7
stage: release
only:
- master@applaudience/showtime-data-management-program
script:
- export NPM_CONFIG_LOGLEVEL=warn
- export NPM_CONFIG_DEPTH=0
- npm install semantic-release-gitlab -g
- NODE_ENV=development npm install
- NODE_ENV=production npm run build
- DEBUG=* semantic-release-gitlab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment