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

build(Dockerfile-app): add Dockerfile for building the app image feat(docker-compose.yml): use pre-built image for api service instead of building from local file

Danny Avilaf5ff91cfbd3e
diff --git a/Dockerfile-app b/Dockerfile-app
new file mode 100644
index 0000000000..3a71564a13
--- /dev/null
+++ b/Dockerfile-app
@@ -0,0 +1,35 @@
+# ./Dockerfile
+
+FROM node:19-alpine
+WORKDIR /app
+
+# Copy package.json files for client and api
+COPY /client/package*.json /app/client/
+COPY /api/package*.json /app/api/
+
+# Install dependencies for both client and api
+RUN cd /app/client && npm ci
+RUN cd /app/api && npm ci
+
+# Copy the current directory contents into the container
+COPY /client/ /app/client/
+COPY /api/ /app/api/
+
+# Set the memory limit for Node.js
+ENV NODE_OPTIONS="--max-old-space-size=2048"
+
+# Build webpack artifacts for the client
+RUN cd /app/client && npm run build
+
+# Create the necessary directory and copy the client side code to the api directory
+RUN mkdir -p /app/api/client && cp -R /app/client/dist /app/api/client/dist
+
+# 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
+WORKDIR /app/api
+CMD ["npm", "start"]
diff --git a/docker-compose.yml b/docker-compose.yml
index c6c5372678..ce58ed096c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,13 +15,14 @@ services:
# - api
api:
ports:
- - 3080:3080 # Change it to 9000:3080 if you want to use nginx
+ - 3080:3080 # Change it to 9000:3080 to use nginx
depends_on:
- mongodb
- image: node-api
- build:
- context: .
- target: node-api
+ # image: node-api # Uncomment this to build from local file
+ # build:
+ # context: .
+ # target: node-api
+ image: chatgptclone/app:0.3.3 # Comment this & uncomment above to build from local file
restart: always
env_file:
- ./api/.env