forked from XiaoMo/ChatGPT-Next-Web
feat: add docker proxy
This commit is contained in:
parent
40b8b225f9
commit
c8be5e4267
12
Dockerfile
12
Dockerfile
@ -3,6 +3,7 @@ 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
|
||||
|
||||
@ -27,6 +28,7 @@ RUN yarn build
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV PROXY_URL=""
|
||||
ENV OPENAI_API_KEY=""
|
||||
ENV CODE=""
|
||||
|
||||
@ -37,4 +39,12 @@ COPY --from=builder /app/.next/server ./.next/server
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node","server.js"]
|
||||
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
|
Loading…
Reference in New Issue
Block a user