-
-
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.
Optimize Dockerfile and docker-compose.yml for multi-stage build and …
…volume management
- Loading branch information
Showing
2 changed files
with
10 additions
and
12 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,15 +1,15 @@ | ||
FROM node:22-slim | ||
|
||
# Build stage | ||
FROM node:22-slim AS builder | ||
WORKDIR /usr/src/app | ||
|
||
ARG PORT | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
EXPOSE ${PORT} | ||
|
||
# Runtime stage | ||
FROM node:22-slim as runner | ||
WORKDIR /usr/src/app | ||
COPY --from=builder /usr/src/app/node_modules ./node_modules | ||
COPY . . | ||
ARG APP_PORT | ||
EXPOSE ${APP_PORT} | ||
CMD ["npm", "run", "start:prod"] |
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