Skip to content

Commit

Permalink
Merge pull request #3 from UKHomeOffice/bugfix/npm-auth-config
Browse files Browse the repository at this point in the history
Standardise npm auth config across projects
  • Loading branch information
lennym authored Mar 29, 2018
2 parents b1605c6 + f48d5a6 commit 22cb587
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
24 changes: 8 additions & 16 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
pipeline:

npm_auth:
test:
image: node:8
secrets:
- npm_auth_token
commands:
- echo "_authToken=$${NPM_AUTH_TOKEN}" >> .npmrc
when:
event: [push, pull_request]

test:
image: node:8
commands:
- npm install
- npm test
when:
event: [push, pull_request]

compile:
image: node:8
commands:
- npm run build
when:
event: [push, pull_request]

build:
image: docker:17.09.1
environment:
- DOCKER_HOST=tcp://172.17.0.1:2375
commands:
- docker build -t asl .
- docker build --build-arg NPM_AUTH_USERNAME=$${NPM_AUTH_USERNAME} --build-arg NPM_AUTH_TOKEN=$${NPM_AUTH_TOKEN} -t asl .
when:
branch: master
event: push
Expand Down Expand Up @@ -63,6 +49,8 @@ pipeline:

configure_deploy:
image: node:8
secrets:
- npm_auth_token
commands:
- mkdir deploy
- npx kube-cookbook --out deploy
Expand All @@ -83,3 +71,7 @@ pipeline:
when:
environment: dev
event: deployment

matrix:
NPM_AUTH_USERNAME:
- asl
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
@asl:registry = https://artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/

//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:username=${NPM_AUTH_USERNAME}
//artifactory.digital.homeoffice.gov.uk/artifactory/api/npm/npm-virtual/:_password=${NPM_AUTH_TOKEN}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM quay.io/ukhomeofficedigital/nodejs-base:v8

ARG NPM_AUTH_USERNAME
ARG NPM_AUTH_TOKEN

COPY .npmrc /app/.npmrc
COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json
RUN npm install --production --no-optional
COPY . /app

RUN rm /app/.npmrc

USER nodejs

CMD node index.js

0 comments on commit 22cb587

Please sign in to comment.