diff --git a/Dockerfile b/Dockerfile index f7d7b1b..4336037 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,16 @@ ARG NODE_VERSION=20.0.0 FROM node:${NODE_VERSION}-alpine -# Use production node environment by default. ENV NODE_ENV production WORKDIR /app -# Run the application as a non-root user. + +RUN --mount=type=bind,source=package.json,target=package.json \ +    --mount=type=bind,source=package-lock.json,target=package-lock.json \ +    --mount=type=cache,target=/root/.npm + +# Run the application as a root user. USER root # Copy the rest of the source files into the image. @@ -19,3 +23,4 @@ EXPOSE 8000 # Run the application. CMD node app.js +