1 FROM node:14.16.0-buster-slim
4 RUN mkdir -p /npm_cache
8 RUN npm install npm@^6 -g
9 RUN npm config set cache /npm_cache
10 RUN npm config set prefer-offline true
12 COPY package.json package-lock.json scripts/filter-package-json-cli.js scripts/filter-package-lock-json-cli.js /app/
13 # Remove the local dependencies(`file:` entries) from package.json and package-lock.json
14 RUN cat package.json | node filter-package-json-cli.js > temp-package.json && cat temp-package.json > package.json && rm temp-package.json
15 RUN cat package-lock.json | node filter-package-lock-json-cli.js > temp-package-lock.json && cat temp-package-lock.json > package-lock.json && rm temp-package-lock.json
17 # git is required to fetch some NPM packages,
18 # ca-certificates for various requests over https
19 # make is required for some steps of the pipeline (see .gitlab-ci.yml and Makefile)
20 # we add (and then remove) the dependencies to install node-gyp
22 && apt-get install -y --no-install-recommends ca-certificates git make python g++ \
23 # Normally we use `npm install --production` but we need the
24 # devDependencies(like webpack) installed so we can run in NODE_ENV=test-docker
26 # We keep the python and g++ around so we can re-install everything later in CI if necessary
28 RUN rm -rf /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp /root/.gnupg /root/.ssh 2>/dev/null