Skip to content

Commit

Permalink
Clean up Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoli Nicolae <[email protected]>
  • Loading branch information
anatolinicolae committed Mar 21, 2024
1 parent ec18d10 commit 1dcd3af
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,29 @@
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

# 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

# Build the app
FROM base as build

WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules

ADD /app/database ./app/database
Expand All @@ -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
Expand All @@ -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" ]

0 comments on commit 1dcd3af

Please sign in to comment.