From 593bba076cb91686aa6fac4069486a4ad0115ed5 Mon Sep 17 00:00:00 2001 From: kpj2006 <24ucs074@lnmiit.ac.in> Date: Sun, 5 Jul 2026 07:04:33 +0530 Subject: [PATCH 1/2] feat: add Docker support with multi-stage build, Nginx configuration, and Docker Compose orchestration --- .dockerignore | 17 +++++++++++++++++ Dockerfile | 27 +++++++++++++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ docker-compose.yml | 9 +++++++++ nginx.conf | 23 +++++++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0492bc0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +node_modules/ +dist/ +build/ +.git/ +.github/ +.lighthouseci/ +.vscode/ +.idea/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +.env +.env.* +Dockerfile +docker-compose.yml +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0061388 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Stage 1: Build the React application +FROM node:22-alpine AS build + +WORKDIR /app + +# Copy package files and install dependencies +COPY package*.json ./ +RUN npm ci + +# Copy the rest of the application source code +COPY . . + +# Build the application for production +RUN npm run build + +# Stage 2: Serve the application using Nginx +FROM nginx:stable-alpine + +# Copy the build output to Nginx HTML directory +COPY --from=build /app/dist /usr/share/nginx/html + +# Copy custom Nginx configuration for client-side routing support +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index 7cb9cea..ddc88dd 100644 --- a/README.md +++ b/README.md @@ -310,6 +310,30 @@ We welcome contributions from developers, designers, and open-source enthusiasts - Pull request guidelines - Community communication +## 🐳 Docker Support + +You can run OrgExplorer in a containerized environment using Docker or Docker Compose. This is useful for self-hosting in your own infrastructure. + +### Build and Run with Docker Compose (Recommended) + +1. Build and start the container: + ```bash + docker compose up --build -d + ``` +2. Access the application in your browser at http://localhost:8080. + +### Build and Run with Docker CLI + +1. Build the Docker image: + ```bash + docker build -t orgexplorer . + ``` +2. Run the container: + ```bash + docker run -d -p 8080:80 orgexplorer + ``` +3. Access the application in your browser at http://localhost:8080. + ## 📍 License This project is licensed under the GNU General Public License v3.0. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2de8512 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +services: + orgexplorer: + build: + context: . + dockerfile: Dockerfile + container_name: orgexplorer-app + ports: + - "8080:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..4bb9a42 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,23 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + # Enable gzip compression for better performance + gzip on; + gzip_vary on; + gzip_min_length 10240; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript; + gzip_disable "MSIE [1-6]\."; + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} From d1622822f3e45959cfa5aad5a0743ddda3770376 Mon Sep 17 00:00:00 2001 From: kpj2006 <24ucs074@lnmiit.ac.in> Date: Sun, 5 Jul 2026 09:54:54 +0530 Subject: [PATCH 2/2] feat: add healthcheck to Nginx container in Dockerfile --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0061388..6283bb5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,4 +24,8 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 +HEALTHCHECK --interval=30s --timeout=3s \ + CMD curl -f http://localhost/ || exit 1 + CMD ["nginx", "-g", "daemon off;"] +