Skip to content

Commit d9617c3

Browse files
authored
Merge pull request #661 from ishitaajain-coder/ishitaajain-coder-dockerfiles
Changes in dockerfiles and node version
2 parents cab0103 + dc35fe9 commit d9617c3

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
FROM node:18-alpine AS builder
1+
FROM node:20-alpine
22

3-
# Set working directory inside the container
43
WORKDIR /app
54

65
COPY package*.json ./
76

8-
# Install dependencies with legacy peer deps fix
97
RUN npm install --legacy-peer-deps
108

119
COPY . .
12-
RUN npm run build
1310

14-
# Production Image
15-
FROM node:18-alpine
16-
WORKDIR /app
17-
COPY --from=builder /app /app
11+
# No need to run 'npm run build' for development-mode Docker
1812
EXPOSE 3000
1913

20-
CMD ["npm", "run","serve"]
14+
CMD [ "npm", "run", "dev" ]

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,25 @@ docker run -p 3000:3000 recodehive-app
8080

8181
This command will start a development server and open the application in your default web browser.
8282

83+
## ⚡ Local Development with Docker Compose & Hot Reload
84+
85+
For an even smoother experience, contributors can leverage **Docker Compose with hot reloading**.
86+
This lets you see code changes instantly at [http://localhost:3000](http://localhost:3000) without rebuilding or restarting containers.
87+
88+
### 🏃 Quick Start
89+
90+
```bash
91+
git clone https://github.com/your-username/recodehive-website.git
92+
cd recodehive-website
93+
docker-compose up
94+
```
95+
96+
### 🚢 Production Deployment
97+
```bash
98+
npm run build
99+
npm run serve
100+
```
101+
83102
**If you'd like to contribute to CodeHarborHub, please follow these guidelines:**
84103

85104
- **Fork** the repository and clone it locally.

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
version: "3.9"
2-
32
services:
43
recodehive:
54
build:
@@ -8,8 +7,8 @@ services:
87
- "3000:3000"
98
volumes:
109
- .:/app
11-
- /app/node_modules
10+
- /app/node_modules # Prevents node_modules being overwritten by the mount
1211
working_dir: /app
13-
command: npm run start
12+
command: npm run dev # THIS is the crucial change for hot-reload!
1413
environment:
1514
- NODE_ENV=development

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"scripts": {
66
"docusaurus": "docusaurus",
7+
"dev": "docusaurus start",
78
"start": "docusaurus start",
89
"build": "docusaurus build",
910
"swizzle": "docusaurus swizzle",

0 commit comments

Comments
 (0)