diff --git a/Dockerfile b/Dockerfile index e1c258c39..409b1d61c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,9 @@ FROM node:20-bookworm-slim as base # set for base and all layer that inherit from it -ENV NODE_ENV production +ENV NODE_ENV="production" + +WORKDIR /myapp # Install openssl for Prisma RUN apt-get update && apt-get install -y openssl @@ -10,16 +12,12 @@ RUN apt-get update && apt-get install -y openssl # Install all node_modules, including dev dependencies FROM base as deps -WORKDIR /myapp - ADD package.json ./ RUN npm install --production=false # Setup production node_modules FROM base as production-deps -WORKDIR /myapp - COPY --from=deps /myapp/node_modules /myapp/node_modules ADD package.json ./ RUN npm prune --production @@ -27,8 +25,6 @@ RUN npm prune --production # Build the app FROM base as build -WORKDIR /myapp - COPY --from=deps /myapp/node_modules /myapp/node_modules ADD /app/database ./app/database @@ -43,8 +39,6 @@ FROM base ENV PORT="8080" ENV NODE_ENV="production" -WORKDIR /myapp - COPY --from=production-deps /myapp/node_modules /myapp/node_modules COPY --from=build /myapp/node_modules/.prisma /myapp/node_modules/.prisma COPY --from=build /myapp/app/database /myapp/app/database @@ -55,4 +49,4 @@ COPY --from=build /myapp/package.json /myapp/package.json COPY --from=build /myapp/docker-entrypoint.sh /myapp/docker-entrypoint.sh RUN chmod +x /myapp/docker-entrypoint.sh -ENTRYPOINT [ "./docker-entrypoint.sh" ] +ENTRYPOINT [ "/myapp/docker-entrypoint.sh" ]