diff --git a/docs/deployment/docker.md b/docs/deployment/docker.md index ff31a6a81f..d46aff1b06 100644 --- a/docs/deployment/docker.md +++ b/docs/deployment/docker.md @@ -69,6 +69,9 @@ RUN apt-get update && \ USER node WORKDIR /app +# This switches many Node.js dependencies to production mode. +ENV NODE_ENV production + # Copy repo skeleton first, to avoid unnecessary docker cache invalidation. # The skeleton contains the package.json of each package in the monorepo, # and along with yarn.lock and the root package.json, that's enough to run yarn install. @@ -190,6 +193,9 @@ RUN apt-get update && \ USER node WORKDIR /app +# This switches many Node.js dependencies to production mode. +ENV NODE_ENV production + # Copy the install dependencies from the build stage and context COPY --from=build --chown=node:node /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton.tar.gz ./ RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz diff --git a/packages/backend/Dockerfile b/packages/backend/Dockerfile index bda34fa045..ed18da530b 100644 --- a/packages/backend/Dockerfile +++ b/packages/backend/Dockerfile @@ -22,6 +22,9 @@ RUN apt-get update && \ USER node WORKDIR /app +# This switches many Node.js dependencies to production mode. +ENV NODE_ENV production + # Copy repo skeleton first, to avoid unnecessary docker cache invalidation. # The skeleton contains the package.json of each package in the monorepo, # and along with yarn.lock and the root package.json, that's enough to run yarn install. diff --git a/packages/create-app/templates/default-app/packages/backend/Dockerfile b/packages/create-app/templates/default-app/packages/backend/Dockerfile index c926ba350b..682798b826 100644 --- a/packages/create-app/templates/default-app/packages/backend/Dockerfile +++ b/packages/create-app/templates/default-app/packages/backend/Dockerfile @@ -22,6 +22,9 @@ RUN apt-get update && \ USER node WORKDIR /app +# This switches many Node.js dependencies to production mode. +ENV NODE_ENV production + # Copy repo skeleton first, to avoid unnecessary docker cache invalidation. # The skeleton contains the package.json of each package in the monorepo, # and along with yarn.lock and the root package.json, that's enough to run yarn install.