-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
impr(refactor): Created multi-stage in Dockerfile, enhanced ReadMe (@…
…ilolm) (#770) * Optimize Dockerfile 1. Reduced image size from 2.86GB to 790MB by implementing multi-stage. 2. Optimized image and its security. * Update README.md Added separators for more readability
- Loading branch information
Showing
2 changed files
with
69 additions
and
4 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,7 +1,24 @@ | ||
FROM node:20-alpine | ||
RUN apk add --no-cache python3 py3-pip | ||
# Build | ||
FROM node:20-alpine as build | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
RUN yarn install && yarn compile | ||
|
||
RUN apk update --no-cache && \ | ||
apk add --no-cache python3 py3-pip && \ | ||
|
||
echo "Installing && Compiling" && \ | ||
yarn install && yarn compile | ||
|
||
|
||
# Prod | ||
FROM node:20-alpine | ||
|
||
# Copy the necessary files from the build stage | ||
COPY --from=build /app/packages/cli/built /app/packages/cli/built | ||
COPY --from=build /app/node_modules /app/node_modules | ||
COPY --from=build /app/package.json /app/package.json | ||
|
||
EXPOSE 8003 | ||
CMD ["node", "packages/cli/built/genaiscript.cjs", "serve"] | ||
|
||
CMD ["node", "/app/packages/cli/built/genaiscript.cjs", "serve"] |
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