Skip to content

Commit

Permalink
chore:
Browse files Browse the repository at this point in the history
  • Loading branch information
이은상 committed Dec 26, 2024
1 parent c9b6ede commit 4fd3d56
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions 7_auth/7_1_express_js/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 4fd3d56

Please sign in to comment.