-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from haseebzaki-07/new_branch
feat: Added the Dockerfile #155
- Loading branch information
Showing
6 changed files
with
114 additions
and
0 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 |
---|---|---|
@@ -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 |