Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit 73d6484

Browse files
codebanesrcodebanesr
authored andcommitted
reduced the size of llm server production build
1 parent d157f0e commit 73d6484

File tree

6 files changed

+478
-1660
lines changed

6 files changed

+478
-1660
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636

3737
llm-server:
3838
restart: unless-stopped
39-
image: codebanesr/openchat_llm_server:latest
39+
image: codebanesr/openchat_llm_server:edge
4040
volumes:
4141
- shared_data:/app/shared_data
4242
env_file:

llm-server/.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
npm-debug.log
3+
yarn-error.log
4+
dist
5+
Dockerfile*
6+
docker-compose*
7+
README.md
8+
.git
9+
.gitignore
10+
.vscode
11+
.env

llm-server/Dockerfile

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1-
# Use an official Node.js runtime as the base image
2-
FROM node:18
1+
FROM node:18-alpine as builder
2+
WORKDIR /my-space
33

4-
# Set the working directory
5-
WORKDIR /usr/src/app
6-
7-
# Copy package.json and yarn.lock
8-
COPY package*.json yarn.lock ./
9-
10-
COPY .env .env
11-
12-
# Install dependencies
4+
COPY package.json yarn.lock ./
135
RUN yarn install
14-
15-
# Copy the project files to the container
166
COPY . .
17-
18-
# Expose the container's port (if required by the app)
19-
20-
# Start the app
21-
CMD [ "npm", "run", "dev" ]
22-
23-
24-
25-
26-
7+
RUN npm run build
8+
9+
FROM node:18-alpine as runner
10+
WORKDIR /my-space
11+
COPY --from=builder /my-space/package.json .
12+
COPY --from=builder /my-space/package-lock.json .
13+
COPY --from=builder /my-space/next.config.js ./
14+
# COPY --from=builder /my-space/public ./public
15+
COPY --from=builder /my-space/.next/standalone ./
16+
COPY --from=builder /my-space/.next/static ./.next/static
17+
18+
EXPOSE 3000
19+
CMD ["node", "server.js"]

llm-server/next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const nextConfig = {
33
reactStrictMode: true,
44
swcMinify: true,
5+
output: 'standalone',
56
webpack(config) {
67
config.experiments = { ...config.experiments, topLevelAwait: true };
78
return config;

llm-server/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515
"ingest": "tsx -r dotenv/config scripts/ingest-data.ts"
1616
},
1717
"dependencies": {
18-
"@aws-sdk/client-s3": "^3.332.0",
19-
"@microsoft/fetch-event-source": "^2.0.1",
2018
"@pinecone-database/pinecone": "0.0.12",
2119
"@qdrant/js-client-rest": "^1.3.0",
22-
"@radix-ui/react-accordion": "^1.1.1",
2320
"axios": "^1.4.0",
2421
"clsx": "^1.2.1",
2522
"dotenv": "^16.0.3",
2623
"ignore": "^5.2.4",
2724
"langchain": "^0.0.110",
28-
"lucide-react": "^0.125.0",
2925
"next": "13.2.3",
3026
"pdf-parse": "1.1.1",
3127
"react": "18.2.0",

0 commit comments

Comments
 (0)