Urain commited on
Commit
5e90a21
·
1 Parent(s): 8746d57

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -6
Dockerfile CHANGED
@@ -1,6 +1,52 @@
1
- FROM node:19
2
- RUN git clone https://github.com/lobehub/lobe-chat.git
3
- WORKDIR "lobe-chat"
4
- RUN npm i
5
- RUN npm run build
6
- EXPOSE 3000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20-slim AS base
2
+
3
+ RUN apt-get update && apt-get install -y git
4
+ RUN git clone https://github.com/lobehub/lobe-chat.git /app
5
+ ## Install dependencies only when needed
6
+ FROM base AS builder
7
+ ENV PNPM_HOME="/pnpm"
8
+ ENV PATH="$PNPM_HOME:$PATH"
9
+ RUN corepack enable
10
+
11
+ WORKDIR /app
12
+
13
+ # If you want to build docker in China
14
+ #RUN npm config set registry https://registry.npmmirror.com/
15
+ RUN pnpm i
16
+
17
+
18
+ RUN pnpm run build:docker # run build standalone for docker version
19
+
20
+ ## Production image, copy all the files and run next
21
+ FROM base AS runner
22
+ WORKDIR /app
23
+
24
+ ENV NODE_ENV production
25
+
26
+ RUN addgroup --system --gid 1001 nodejs
27
+ RUN adduser --system --uid 1001 nextjs
28
+
29
+ COPY --from=builder /app/public ./public
30
+
31
+ # Set the correct permission for prerender cache
32
+ RUN mkdir .next
33
+ RUN chown nextjs:nodejs .next
34
+
35
+ # Automatically leverage output traces to reduce image size
36
+ # https://nextjs.org/docs/advanced-features/output-file-tracing
37
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
38
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
39
+
40
+ USER nextjs
41
+
42
+ EXPOSE 3210
43
+
44
+ # set hostname to localhost
45
+ ENV HOSTNAME "0.0.0.0"
46
+ ENV PORT=3210
47
+
48
+ # ENV ACCESS_CODE "lobe66"
49
+ # ENV OPENAI_API_KEY ""
50
+ # ENV OPENAI_PROXY_URL ""
51
+
52
+ CMD ["node", "server.js"]