forked from XiaoMo/ChatGPT-Next-Web
feat: add proxy for docker
This commit is contained in:
parent
c8be5e4267
commit
1bb7b4a653
16
Dockerfile
16
Dockerfile
@ -3,12 +3,12 @@ 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 config set registry 'https://registry.npm.taobao.org'
|
||||
RUN yarn install
|
||||
|
||||
FROM base AS builder
|
||||
@ -28,6 +28,8 @@ RUN yarn build
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add proxychains-ng
|
||||
|
||||
ENV PROXY_URL=""
|
||||
ENV OPENAI_API_KEY=""
|
||||
ENV CODE=""
|
||||
@ -43,8 +45,16 @@ 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; \
|
||||
conf=/etc/proxychains.conf; \
|
||||
echo "strict_chain" >> $conf; \
|
||||
echo "proxy_dns" >> $conf; \
|
||||
echo "remote_dns_subnet 224" >> $conf; \
|
||||
echo "tcp_read_time_out 15000" >> $conf; \
|
||||
echo "tcp_connect_time_out 8000" >> $conf; \
|
||||
echo "[ProxyList]" >> $conf; \
|
||||
echo "$protocol $host $port" >> $conf; \
|
||||
cat /etc/proxychains.conf; \
|
||||
proxychains -f $conf node server.js; \
|
||||
else \
|
||||
node server.js; \
|
||||
fi
|
@ -1,14 +1,13 @@
|
||||
import fetch from "node-fetch";
|
||||
import fs from "fs/promises";
|
||||
|
||||
const RAW_CN_URL =
|
||||
"https://raw.githubusercontent.com/PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh.json";
|
||||
const CN_URL =
|
||||
"https://cdn.jsdelivr.net/gh/PlexPt/awesome-chatgpt-prompts-zh@main/prompts-zh.json";
|
||||
const RAW_EN_URL =
|
||||
"https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv";
|
||||
const EN_URL =
|
||||
"https://cdn.jsdelivr.net/gh/f/awesome-chatgpt-prompts@main/prompts.csv";
|
||||
const RAW_FILE_URL = "https://raw.githubusercontent.com/";
|
||||
const MIRRORF_FILE_URL = "https://raw.fgit.ml/";
|
||||
|
||||
const RAW_CN_URL = "PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh.json";
|
||||
const CN_URL = MIRRORF_FILE_URL + RAW_CN_URL;
|
||||
const RAW_EN_URL = "f/awesome-chatgpt-prompts/main/prompts.csv";
|
||||
const EN_URL = MIRRORF_FILE_URL + RAW_EN_URL;
|
||||
const FILE = "./public/prompts.json";
|
||||
|
||||
async function fetchCN() {
|
||||
|
Loading…
Reference in New Issue
Block a user