mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2024-11-27 08:53:17 +08:00
50 lines
1.0 KiB
Docker
50 lines
1.0 KiB
Docker
FROM node:18-alpine AS base
|
|
|
|
FROM base AS deps
|
|
|
|
RUN apk add --no-cache libc6-compat
|
|
RUN apk --no-cache add proxychains-ng
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json yarn.lock ./
|
|
|
|
RUN yarn install
|
|
|
|
FROM base AS builder
|
|
|
|
RUN apk update && apk add --no-cache git
|
|
|
|
ENV OPENAI_API_KEY=""
|
|
ENV CODE=""
|
|
ARG DOCKER=true
|
|
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
RUN yarn build
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
ENV PROXY_URL=""
|
|
ENV OPENAI_API_KEY=""
|
|
ENV CODE=""
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/.next/standalone ./
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
COPY --from=builder /app/.next/server ./.next/server
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD if [ -n "$PROXY_URL" ]; then \
|
|
protocol=$(echo $PROXY_URL | cut -d: -f1); \
|
|
host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
|
|
port=$(echo $PROXY_URL | cut -d: -f3); \
|
|
echo "$protocol $host $port" >> /etc/proxychains.conf; \
|
|
proxychains node server.js; \
|
|
else \
|
|
node server.js; \
|
|
fi |