diff --git a/Dockerfile b/Dockerfile index 915af286..fdb99554 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,14 @@ -FROM node:18-alpine AS builder +FROM node:20-alpine -# Set working directory inside the container WORKDIR /app COPY package*.json ./ -# Install dependencies with legacy peer deps fix RUN npm install --legacy-peer-deps COPY . . -RUN npm run build -# Production Image -FROM node:18-alpine -WORKDIR /app -COPY --from=builder /app /app +# No need to run 'npm run build' for development-mode Docker EXPOSE 3000 -CMD ["npm", "run","serve"] \ No newline at end of file +CMD [ "npm", "run", "dev" ] diff --git a/README.md b/README.md index 33632d9e..6f0bd607 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,25 @@ docker run -p 3000:3000 recodehive-app This command will start a development server and open the application in your default web browser. +## ⚡ Local Development with Docker Compose & Hot Reload + +For an even smoother experience, contributors can leverage **Docker Compose with hot reloading**. +This lets you see code changes instantly at [http://localhost:3000](http://localhost:3000) without rebuilding or restarting containers. + +### 🏃 Quick Start + +```bash +git clone https://github.com/your-username/recodehive-website.git +cd recodehive-website +docker-compose up +``` + +### 🚢 Production Deployment +```bash +npm run build +npm run serve +``` + **If you'd like to contribute to CodeHarborHub, please follow these guidelines:** - **Fork** the repository and clone it locally. diff --git a/docker-compose.yml b/docker-compose.yml index 3b09ec5c..6a9e77b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,4 @@ version: "3.9" - services: recodehive: build: @@ -8,8 +7,8 @@ services: - "3000:3000" volumes: - .:/app - - /app/node_modules + - /app/node_modules # Prevents node_modules being overwritten by the mount working_dir: /app - command: npm run start + command: npm run dev # THIS is the crucial change for hot-reload! environment: - NODE_ENV=development diff --git a/package.json b/package.json index b42bb8b0..d79e8d6f 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "scripts": { "docusaurus": "docusaurus", + "dev": "docusaurus start", "start": "docusaurus start", "build": "docusaurus build", "swizzle": "docusaurus swizzle", @@ -15,14 +16,14 @@ "typecheck": "tsc" }, "dependencies": { - "@docusaurus/core": "^3.8.1", - "@docusaurus/plugin-content-docs": "3.8.1", - "@docusaurus/plugin-google-analytics": "^3.8.1", - "@docusaurus/plugin-ideal-image": "3.8.1", - "@docusaurus/preset-classic": "^3.8.1", - "@docusaurus/theme-classic": "^3.8.1", - "@docusaurus/theme-mermaid": "3.8.1", - "@docusaurus/theme-search-algolia": "3.8.1", + "@docusaurus/core": "^3.9.1", + "@docusaurus/plugin-content-docs": "3.9.1", + "@docusaurus/plugin-google-analytics": "^3.9.1", + "@docusaurus/plugin-ideal-image": "3.9.1", + "@docusaurus/preset-classic": "^3.9.1", + "@docusaurus/theme-classic": "^3.9.1", + "@docusaurus/theme-mermaid": "3.9.1", + "@docusaurus/theme-search-algolia": "3.9.1", "@floating-ui/react": "^0.27.8", "@giscus/react": "^3.1.0", "@mdx-js/react": "^3.0.0",