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

Move Dockerfiles into one toplevel Dockerfile

Hyunggyu Jangc233cc0d5c1a
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000..2ca2e86e87
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+**/node_modules
+**/.env
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000..f1dc95b254
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,27 @@
+FROM node:19-alpine AS react-client
+WORKDIR /client
+# copy package.json into the container at /client
+COPY /client/package*.json /client/
+# install dependencies
+RUN npm ci
+# Copy the current directory contents into the container at /client
+COPY /client/ /client/
+# Build webpack artifacts
+RUN npm run build
+
+FROM node:19-alpine AS node-api
+WORKDIR /api
+# copy package.json into the container at /api
+COPY /api/package*.json /api/
+# install dependencies
+RUN npm ci
+# Copy the current directory contents into the container at /api
+COPY /api/ /api/
+# Copy the client side code
+COPY --from=react-client /client/public /client/public
+# Make port 3080 available to the world outside this container
+EXPOSE 3080
+# Expose the server to 0.0.0.0
+ENV HOST=0.0.0.0
+# Run the app when the container launches
+CMD ["npm", "start"]
diff --git a/api/.dockerignore b/api/.dockerignore
deleted file mode 100644
index 7af7f04757..0000000000
--- a/api/.dockerignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/node_modules
-.env
\ No newline at end of file
diff --git a/api/Dockerfile b/api/Dockerfile
deleted file mode 100644
index d417bf1ec4..0000000000
--- a/api/Dockerfile
+++ /dev/null
@@ -1,16 +0,0 @@
-FROM node:19-alpine
-WORKDIR /api
-# copy package.json into the container at /api
-COPY package*.json /api/
-# install dependencies
-RUN npm ci
-# Copy the current directory contents into the container at /api
-COPY . /api/
-# Make port 3080 available to the world outside this container
-EXPOSE 3080
-# Expose the server to 0.0.0.0
-ENV HOST=0.0.0.0
-# Run the app when the container launches
-CMD ["npm", "start"]
-
-# docker build -t node-api .
diff --git a/docker-compose.yml b/docker-compose.yml
index 401055f988..6d452f0f32 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,50 +1,29 @@
-version: "2"
+version: "3.4"
services:
- client:
- image: react-client
- build: ./client
- restart: always
- ports:
- - "3080:80"
- volumes:
- - ./client:/client
- - /client/node_modules
- links:
- - api
- networks:
- - webappnetwork
- api:
- image: node-api
- build: ./api
- restart: always
- env_file:
- - ./api/.env
- environment:
- - HOST=0.0.0.0
- - NODE_ENV=production
- - MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
- ports:
- - "9000:3080"
- volumes:
- - ./api:/api
- - /api/node_modules
- depends_on:
- - mongodb
- networks:
- - webappnetwork
- mongodb:
- image: mongo
- restart: always
- container_name: mongodb
- volumes:
- - ./data-node:/data/db
- ports:
- - 27020:27017
- command: mongod --noauth
- networks:
- - webappnetwork
-
-networks:
- webappnetwork:
- driver: bridge
+ api:
+ ports:
+ - 3080:3080
+ depends_on:
+ - mongodb
+ image: node-api
+ build:
+ context: .
+ target: node-api
+ restart: always
+ env_file:
+ - ./api/.env
+ environment:
+ - HOST=0.0.0.0
+ - NODE_ENV=production
+ - MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
+ volumes:
+ - ./api:/api
+ - /api/node_modules
+ mongodb:
+ image: mongo
+ restart: always
+ container_name: mongodb
+ volumes:
+ - ./data-node:/data/db
+ command: mongod --noauth