@@ -14,13 +14,14 @@ ENV NODE_ENV production
|
|||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY package.json .
|
||||||
|
COPY package-lock.json .
|
||||||
|
|
||||||
# Download dependencies as a separate step to take advantage of Docker's caching.
|
# Download dependencies as a separate step to take advantage of Docker's caching.
|
||||||
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
|
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
|
||||||
# Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into
|
# Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into
|
||||||
# into this layer.
|
# into this layer.
|
||||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
RUN --mount=type=cache,target=/root/.npm \
|
||||||
--mount=type=bind,source=package-lock.json,target=package-lock.json \
|
|
||||||
--mount=type=cache,target=/root/.npm \
|
|
||||||
npm ci --omit=dev
|
npm ci --omit=dev
|
||||||
|
|
||||||
# Run the application as a non-root user.
|
# Run the application as a non-root user.
|
||||||
|
|||||||
Reference in New Issue
Block a user