perf(docker): reorder commands to improve caching (maybe?)

This commit is contained in:
Isaac 2023-02-15 01:22:09 +00:00
parent ec8589393b
commit 64da241a76
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -2,12 +2,12 @@
FROM node:18-alpine AS builder FROM node:18-alpine AS builder
WORKDIR /build WORKDIR /build
COPY package.json pnpm-lock.yaml ./
COPY --link scripts scripts
# install python etc so node-gyp works for the optional dependencies # install python etc so node-gyp works for the optional dependencies
RUN apk add --no-cache make gcc g++ python3 RUN apk add --no-cache make gcc g++ python3
# install pnpm to make dependency installation faster (because it has a lockfile) # install pnpm to make dependency installation faster (because it has a lockfile)
RUN npm install -g pnpm RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml ./
COPY --link scripts scripts
# install dependencies, CI=true to skip pre/postinstall scripts # install dependencies, CI=true to skip pre/postinstall scripts
RUN CI=true pnpm install --prod --frozen-lockfile RUN CI=true pnpm install --prod --frozen-lockfile
COPY --link . . COPY --link . .