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