Skip to content
Snippets Groups Projects
Commit 5f91b5a0 authored by Philippe Bordron's avatar Philippe Bordron
Browse files

feat: add npm caching in ci/cd

parent 0972bf31
No related branches found
No related tags found
No related merge requests found
Pipeline #187392 failed
stages:
- build
default:
cache: # Cache modules using lock file
key:
files:
- package-lock.json
paths:
- .npm/
.build_template:
stage: build
tags: ["stable"]
......@@ -18,7 +26,13 @@ stages:
- docker build
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
--build-arg BUILDKIT_INLINE_CACHE=1
NPM_CACHE=$CI_PROJECT_DIR/.npm
.
- pwd
- ls
- ls /builds
- echo $CI_PROJECT_DIR
- ls $CI_PROJECT_DIR
after_script:
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
......@@ -28,6 +42,7 @@ build:
rules:
- changes: # the stage will start if one of those files has changed.
- package.json
- .gitlab-ci.yml
when: always
build_manual:
......
......@@ -4,6 +4,8 @@ WORKDIR /app
COPY package*.json .
RUN npm install
RUN echo $NPM_CACHE && ls $NPM_CACHE
RUN --mount=type=cache,target=$NPM_CACHE \
npm ci --cache $NPM_CACHE
# If you are building your code for production
# RUN npm ci --omit=dev
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment