From e5be5ae4d501c813102a33aa7f20065a7b4ccb26 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 17 Mar 2023 15:38:46 +0100 Subject: [PATCH] Switched to npm cache for build --- .drone.yml | 13 +++++++++---- Dockerfile | 7 +++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 862342d..79f0a8f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,13 @@ get: path: odit-registry-builder name: password +--- +kind: secret +name: npm_url +get: + path: odit-npm-cache + name: url + --- kind: pipeline type: kubernetes @@ -25,10 +32,8 @@ steps: password: from_secret: docker_password build_args: - - NPM_REGISTRY_DOMAIN: - from_secret: npmjs_domain - - NPM_REGISTRY_TOKEN: - from_secret: npmjs_token + - NPM_REGISTRY_URL: + from_secret: npm_url repo: lfk/docs tags: - latest diff --git a/Dockerfile b/Dockerfile index 5eac26d..954b9eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,13 @@ FROM registry.odit.services/hub/library/node:16.15.1-alpine3.16 AS build +ARG NPM_REGISTRY_URL=https://registry.npmjs.org WORKDIR /app + COPY package.json *.config.cjs *.config.js ./ -RUN npm config set registry https://$NPM_REGISTRY_DOMAIN && npm config set //$NPM_REGISTRY_DOMAIN/:_authToken $NPM_REGISTRY_TOKEN -RUN npm i -g pnpm && pnpm i +RUN npm config set registry $NPM_REGISTRY_URL && npm i -g pnpm@7.29.3 +RUN pnpm i COPY . ./ RUN pnpm build + # final image FROM registry.odit.services/library/nginx-brotli:3.15.130 COPY --from=build /app/src/.vuepress/dist /usr/share/nginx/html