-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] Health Check service in Docker Compose
[optimize] reduce Docker image size
- Loading branch information
Showing
2 changed files
with
54 additions
and
36 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,20 +1,20 @@ | ||
FROM node:18-slim | ||
# Reference: https://pnpm.io/docker#example-1-build-a-bundle-in-a-docker-container | ||
|
||
USER root | ||
FROM node:18-slim AS base | ||
RUN apt-get update && \ | ||
apt-get install curl -y --no-install-recommends | ||
COPY . /app | ||
WORKDIR /app | ||
|
||
RUN npm rm yarn -g | ||
FROM base AS prod-deps | ||
RUN npm i --prod | ||
|
||
RUN mkdir /home/node/app | ||
WORKDIR /home/node/app | ||
|
||
COPY package.json package-lock.json file-content-injector.js /home/node/app/ | ||
FROM base AS build | ||
RUN npm i | ||
|
||
COPY . /home/node/app | ||
RUN npm run build | ||
|
||
RUN npm prune --production || true \ | ||
npm cache clean -f | ||
|
||
FROM base | ||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
COPY --from=build /app/dist /app/dist | ||
EXPOSE 3000 | ||
CMD ["npm", "start"] |
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