-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
이은상
committed
Dec 26, 2024
1 parent
c9b6ede
commit 4fd3d56
Showing
1 changed file
with
12 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |