Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

Provide nginx docker build recipe

Hyunggyu Jang40ed6fa9eccb
diff --git a/Dockerfile b/Dockerfile
index f1dc95b254..ce95f49f45 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,3 +25,11 @@ EXPOSE 3080
ENV HOST=0.0.0.0
# Run the app when the container launches
CMD ["npm", "start"]
+
+# Optional: for client with nginx routing
+FROM nginx:stable-alpine AS nginx-client
+WORKDIR /usr/share/nginx/html
+COPY --from=react-client /client/public /usr/share/nginx/html
+# Add your nginx.conf
+COPY /client/nginx.conf /etc/nginx/conf.d/default.conf
+ENTRYPOINT ["nginx", "-g", "daemon off;"]
diff --git a/client/nginx.conf b/client/nginx.conf
new file mode 100644
index 0000000000..1924aded1e
--- /dev/null
+++ b/client/nginx.conf
@@ -0,0 +1,15 @@
+server {
+ listen 80;
+ server_name localhost;
+
+ location / {
+ # Serve your React app
+ root /usr/share/nginx/html;
+ index index.html;
+ }
+
+ location /api {
+ # Proxy requests to the API service
+ proxy_pass http://api:3080/api;
+ }
+}
diff --git a/docker-compose.yml b/docker-compose.yml
index 6d452f0f32..3c1b061638 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,9 +1,21 @@
version: "3.4"
services:
+ # client:
+ # image: react-client
+ # build:
+ # context: .
+ # target: nginx-client
+ # restart: always
+ # ports:
+ # - 3080:80
+ # volumes:
+ # - /client/node_modules
+ # depends_on:
+ # - api
api:
ports:
- - 3080:3080
+ - 3080:3080 # Change it to 9000:3080 if you want to use nginx
depends_on:
- mongodb
image: node-api
@@ -18,6 +30,7 @@ services:
- NODE_ENV=production
- MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
volumes:
+ - /client/node_modules
- ./api:/api
- /api/node_modules
mongodb: