-
Notifications
You must be signed in to change notification settings - Fork 1.4k
add all k8s files #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,12 @@ | ||
| FROM node:14 | ||
| WORKDIR /usr/src/app | ||
| FROM node:18-alpine | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY package*.json ./ | ||
|
|
||
| RUN npm install | ||
|
|
||
| COPY . . | ||
| CMD ["node", "index.js"] | ||
|
|
||
| CMD ["node", "index.js"] | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,19 @@ | ||
| FROM node:14 | ||
| WORKDIR /usr/src/app | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY package*.json ./ | ||
| RUN npm install | ||
|
|
||
| RUN npm install --only=production | ||
|
|
||
| # Install 'serve' globally (for serving static files) | ||
| RUN npm install -g serve | ||
|
|
||
| COPY . . | ||
| CMD [ "npm", "start" ] | ||
|
|
||
| RUN npm run build | ||
|
|
||
| EXPOSE 3000 | ||
|
|
||
| CMD ["serve", "-s", "build", "-l", "3000"] | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Build will likely fail: devDependencies are not installed before
npm run build.npm install --only=productionexcludes devDependencies (e.g., react-scripts), which are required for the build step. This will breaknpm run build. Also, Node 14 is EOL; consider upgrading and using a multi-stage build to reduce image size and improve security.Apply this multi-stage refactor:
Also applies to: 1-20
🤖 Prompt for AI Agents