-
-
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
Merged
RamakrushnaBiswal
merged 6 commits into
RamakrushnaBiswal:main
from
haseebzaki-07:new_branch
Oct 10, 2024
Merged
Added the Dockerfile #156
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7b6a23
ADD Dockerfile
haseebzaki-07 1c74ebc
Add code-rabbit suggestions
haseebzaki-07 74a4563
Merge branch 'RamakrushnaBiswal:main' into new_branch
haseebzaki-07 9aaec53
Add docker-compose
haseebzaki-07 feeed3e
Merge branch 'RamakrushnaBiswal:main' into new_branch
haseebzaki-07 18818b0
Update README.md for Docker setup
haseebzaki-07 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
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/ ./ | ||
|
||
FROM node:18 | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=backend-build /app/backend ./backend | ||
COPY --from=frontend-build /app/frontend ./frontend | ||
|
||
COPY frontend/package*.json ./frontend/ | ||
COPY backend/package*.json ./backend/ | ||
RUN npm install --prefix frontend && npm install --prefix backend | ||
|
||
|
||
COPY start.sh ./ | ||
|
||
RUN chmod +x start.sh | ||
|
||
EXPOSE 5173 3000 | ||
|
||
|
||
CMD ["sh", "start.sh"] |
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
npm-debug.log | ||
.git | ||
.gitignore | ||
README.md |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
version: '3.8' | ||
|
||
services: | ||
frontend: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: frontend-build # Reference the frontend build stage | ||
working_dir: /app/frontend | ||
volumes: | ||
- ./frontend:/app/frontend # Bind-mount the frontend code to support hot-reloading | ||
ports: | ||
- "5173:5173" | ||
command: ["npm", "run", "dev"] | ||
environment: | ||
- NODE_ENV=development | ||
|
||
backend: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: backend-build # Reference the backend build stage | ||
working_dir: /app/backend | ||
volumes: | ||
- ./backend:/app/backend # Bind-mount the backend code to support hot-reloading | ||
ports: | ||
- "3000:3000" | ||
command: ["npm", "run", "dev"] | ||
environment: | ||
- NODE_ENV=development | ||
|
||
full-app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
depends_on: | ||
- frontend | ||
- backend | ||
ports: | ||
- "5173:5173" | ||
- "3000:3000" | ||
command: ["sh", "./start.sh"] | ||
environment: | ||
- NODE_ENV=production | ||
volumes: | ||
- ./frontend:/app/frontend | ||
- ./backend:/app/backend | ||
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
npm-debug.log | ||
.git | ||
.gitignore | ||
README.md |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
cd frontend && npm run dev & | ||
cd backend && npm run dev | ||
RamakrushnaBiswal marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
💡 Codebase verification
Inconsistent Configuration for
full-app
ServiceThe
full-app
service has conflicting settings that are not suitable for a production environment:Development Scripts in Production Mode:
start.sh
script runsnpm run dev
for both frontend and backend, which starts the services in development mode.NODE_ENV
is set toproduction
, leading to conflicting behaviors.Use of Bind Mounts:
volumes
) are utilized to sync the frontend and backend directories.Combined Frontend and Backend Services:
Recommendations:
NODE_ENV
. For production, use scripts that build and serve optimized versions of the applications.🔗 Analysis chain
Clarify the purpose and configuration of the
full-app
service.The
full-app
service configuration raises a few concerns:volumes
) in what appears to be a production environment (NODE_ENV=production
). This is unusual and potentially risky for production deployments.frontend
andbackend
services, which are configured for development. This mixing of development and production configurations in the same compose file could lead to confusion.start.sh
script is referenced but not provided in the context. Its contents and purpose are unclear.Could you please clarify:
start.sh
script? Can you provide its contents?full-app
service alongside the development-configuredfrontend
andbackend
services?You can check the contents of the
start.sh
script with:🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 150
🧰 Tools
🪛 yamllint