Docker
This commit is contained in:
parent
3193e8a462
commit
f2a9404876
15
Dockerfile
15
Dockerfile
|
@ -13,17 +13,14 @@ FROM node:${NODE_VERSION}-alpine
|
||||||
# Use production node environment by default.
|
# Use production node environment by default.
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
|
|
||||||
|
# Working Directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
# Download dependencies as a separate step to take advantage of Docker's caching.
|
# Copy package.json and package-lock.json to the working directory
|
||||||
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
|
COPY package.json package-lock.json ./
|
||||||
# Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into
|
|
||||||
# into this layer.
|
# Install dependencies
|
||||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
RUN npm install
|
||||||
--mount=type=bind,source=package-lock.json,target=package-lock.json \
|
|
||||||
--mount=type=cache,target=/root/.npm \
|
|
||||||
npm ci --omit=dev
|
|
||||||
|
|
||||||
# Run the application as a non-root user.
|
# Run the application as a non-root user.
|
||||||
USER node
|
USER node
|
||||||
|
|
Loading…
Reference in New Issue