Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardise npm auth config across projects #3

Merged
merged 1 commit into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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