Skip to content

Instantly share code, notes, and snippets.

@nsisodiya
Created November 29, 2019 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsisodiya/e4ec6943d79e53e5b8df4e69fc606092 to your computer and use it in GitHub Desktop.
Save nsisodiya/e4ec6943d79e53e5b8df4e69fc606092 to your computer and use it in GitHub Desktop.
.gitlab-ci.yml
image: node:9-alpine
stages:
- lint_test
- build
lint_test:
stage: lint_test
before_script:
- echo registry=https://nexus.growerhub.io/repository/npm-group/ >> ~/.npmrc
- echo _auth=$NEXUS_NPM_TOKEN >> ~/.npmrc
- cat ~/.npmrc
script:
- npm install
- npm run eslint
- npm run test
cache:
paths:
- node_modules
artifacts:
paths:
- node_modules
coverage: /All\sfiles.*?\s+(\d+.\d+)/
variables:
DOCKER_ECR_REPO_URL: 610716223528.dkr.ecr.eu-central-1.amazonaws.com
BRANCH: dev
build:
image: docker:stable
stage: build
dependencies:
- lint_test
services:
- docker:dind
only:
- master
before_script:
- apk add --no-cache curl jq python py-pip
- pip install awscli
script:
- $(aws ecr get-login --no-include-email --region eu-central-1)
- export PACKAGE_VERSION=$(/bin/sh ./getVersion.sh)
- export FULL_DOCKER_URL=${CI_PROJECT_NAME}_${BRANCH}:${PACKAGE_VERSION}
- echo $FULL_DOCKER_URL
- docker build -t $FULL_DOCKER_URL .
- docker tag $FULL_DOCKER_URL $DOCKER_ECR_REPO_URL/$FULL_DOCKER_URL
- docker push $DOCKER_ECR_REPO_URL/$FULL_DOCKER_URL
echo $(cat package.json | grep version | head -1| awk -F: '{ print $2 }' | sed 's/[\",]//g'| tr -d '[[:space:]]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment