-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Added the Dockerfile #156
Added the Dockerfile #156
Changes from 1 commit
a7b6a23
1c74ebc
74a4563
9aaec53
feeed3e
18818b0
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM node:18 AS frontend-build | ||
|
||
WORKDIR /app/frontend | ||
COPY frontend/package*.json ./ | ||
|
||
RUN npm install | ||
COPY frontend/ ./ | ||
|
||
|
||
FROM node:18 AS backend-build | ||
|
||
WORKDIR /app/backend | ||
COPY backend/package*.json ./ | ||
|
||
RUN npm install | ||
COPY backend/ ./ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider using a .dockerignore file for the backend. The backend build stage, like the frontend, follows good practices by leveraging Docker's layer caching. However, copying the entire backend directory might include unnecessary files, potentially increasing the image size. Consider creating a Example
|
||
|
||
FROM node:18 | ||
RUN npm install -g concurrently | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=backend-build /app/backend ./backend | ||
COPY --from=frontend-build /app/frontend ./frontend | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider alternatives to global package installation. While using Consider these alternatives:
These approaches avoid global package installation and provide more flexibility. |
||
EXPOSE 5173 3000 | ||
|
||
CMD concurrently "cd frontend && npm run dev" "cd backend && npm run dev" |
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
Consider using a .dockerignore file for the frontend.
The frontend build stage follows good practices by leveraging Docker's layer caching. However, copying the entire frontend directory might include unnecessary files, potentially increasing the image size.
Consider creating a
.dockerignore
file in the frontend directory to exclude files not needed for the build (e.g., .git, node_modules, etc.). This can help reduce the image size and build time.Example
.dockerignore
content: