-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from yubiuser/multi-stage
Switch to multi-stage build
- Loading branch information
Showing
2 changed files
with
52 additions
and
47 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,10 +1,12 @@ | ||
FROM node:18-alpine3.17 | ||
ENV NODE_ENV=production | ||
FROM node:22-alpine3.19 as builder | ||
WORKDIR /usr/src/app | ||
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"] | ||
RUN npm install --production --silent | ||
RUN mv node_modules ../ | ||
COPY . . | ||
COPY ["package.json", "package-lock.json*", "index.js", "./"] | ||
RUN npm install --omit=dev | ||
|
||
FROM alpine:3.19 as deploy | ||
RUN apk add --no-cache nodejs | ||
COPY --from=builder /usr/src/app /app | ||
WORKDIR /app | ||
EXPOSE 3000 | ||
HEALTHCHECK --interval=10s --timeout=5s --retries=3 --start-period=5s CMD wget --spider http://localhost:8000 > /dev/null || exit 1 | ||
CMD ["npm", "start"] | ||
CMD ["node", "index.js"] |
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