forked from asyncapi/website
-
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.
feat: made the Docker file Multistaged
- Loading branch information
Showing
4 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM node:18-alpine AS build | ||
|
||
WORKDIR /async | ||
|
||
# Install all dependencies | ||
COPY package.json package-lock.json ./ | ||
RUN npm install | ||
|
||
# Copy the rest of the application files | ||
COPY . . | ||
|
||
# Production Stage | ||
FROM node:18-alpine | ||
|
||
WORKDIR /async | ||
|
||
# Install production dependencies only | ||
COPY package.json package-lock.json ./ | ||
RUN npm install --only=production | ||
|
||
# Copy built files from the build stage | ||
COPY --from=build /async . | ||
|
||
EXPOSE 3000 | ||
|
||
# Set environment variables for production | ||
ENV NODE_ENV=production | ||
|
||
CMD ["npm", "run", "start"] | ||
|
||
# Build command -> docker build -f Dockerfile.prod --build-arg NODE_ENV=production -t app-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