From 4fd3d5606faef514bf17dd1a48b02640dcadd93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9D=80=EC=83=81?= Date: Thu, 26 Dec 2024 15:34:38 +0900 Subject: [PATCH] chore: --- 7_auth/7_1_express_js/Dockerfile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/7_auth/7_1_express_js/Dockerfile b/7_auth/7_1_express_js/Dockerfile index 43e9d34..8292ed0 100644 --- a/7_auth/7_1_express_js/Dockerfile +++ b/7_auth/7_1_express_js/Dockerfile @@ -1,42 +1,41 @@ # Step 1: Use an official Node.js image as the base image FROM node:18 AS build -# Step 3: Set the working directory in the container +# Step 2: Set the working directory in the container WORKDIR /app -# Step 4: Copy package.json and package-lock.json (if available) +# Step 3: Copy package.json and package-lock.json (if available) COPY package*.json ./ -# Step 5: Install dependencies (both production and dev) +# Step 4: Install dependencies (both production and dev) RUN npm install -# Step 6: Copy the entire application source code into the container +# Step 5: Copy the entire application source code into the container COPY . . -# Step 7: Build the TypeScript code +# Step 6: Build the TypeScript code RUN npm run build -# Step 8: Now use a smaller production image for runtime (optional) +# Step 7: Now use a smaller production image for runtime (optional) FROM node:18-slim -# Step 9: Set the working directory in the container +# Step 8: Set the working directory in the container WORKDIR /app -# Step 10: Set environment variables for CLIENT_ID and CLIENT_SECRET for runtime -# These will be passed during build and made available in the final image +# Step 9: Set environment variables for CLIENT_ID and CLIENT_SECRET for runtime ARG CLIENT_ID ARG CLIENT_SECRET ENV CLIENT_ID=${CLIENT_ID} ENV CLIENT_SECRET=${CLIENT_SECRET} -# Step 11: Copy the built files from the build stage +# Step 10: Copy the built files from the build stage COPY --from=build /app /app -# Step 12: Install only production dependencies +# Step 11: Install only production dependencies RUN npm install --only=production -# Step 13: Expose the app port +# Step 12: Expose the app port EXPOSE 3000 -# Step 14: Start the application +# Step 13: Start the application CMD ["npm", "start"]