From 1a059446cd3a746cd5c5f78447f994ea9b05a96f Mon Sep 17 00:00:00 2001 From: rca Date: Sun, 23 Jun 2024 17:20:18 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B7=E3=83=B3=E3=82=B0=E3=83=AB=E3=82=B9?= =?UTF-8?q?=E3=83=86=E3=83=BC=E3=82=B8=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index cbe4147..57ab6b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,25 @@ -# Build -FROM node:18-alpine as build +FROM node:18-alpine +# Set working directory WORKDIR /usr/src/kidshift +# Copy package files and install dependencies COPY package*.json ./ - RUN npm install +# Copy Prisma files and generate Prisma client COPY prisma ./prisma/ RUN npx prisma generate -COPY . . - +# Copy the rest of the application code and build the project +COPY . . RUN npm run build -# Runtime -FROM node:18-alpine as runtime -WORKDIR /usr/src/kidshift - -COPY package-lock.json . -COPY package.json . - -COPY --from=build /usr/src/kidshift/dist ./dist -COPY --from=build /usr/src/kidshift/node_modules ./node_modules -COPY --from=build /usr/src/kidshift/prisma ./prisma -COPY --from=build /usr/src/kidshift/src ./src -COPY --from=build /usr/src/kidshift/static ./static - - -# CMD ["npm", "start"] - -# cat package.json to debug -# CMD ["pwd"] -CMD ["ls", "-la"] +# Set environment variables if necessary +ENV NODE_ENV=production +# Expose the application port EXPOSE 3000 + +# Command to run the application +CMD ["npm", "start"]