From 85737e9e9eab6298844b994c6398d25e7adfafcb Mon Sep 17 00:00:00 2001 From: xieyos Date: Sat, 13 Jan 2024 01:26:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BD=E5=86=85Dockerf?= =?UTF-8?q?ile=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile_CN | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Dockerfile_CN diff --git a/Dockerfile_CN b/Dockerfile_CN new file mode 100644 index 00000000000..6fadbe0de82 --- /dev/null +++ b/Dockerfile_CN @@ -0,0 +1,71 @@ +FROM node:18-alpine AS base + +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + +FROM base AS deps + +RUN apk add --no-cache libc6-compat + +WORKDIR /app + +COPY package.json yarn.lock ./ + +RUN yarn config set registry 'https://registry.npm.taobao.org/' + +RUN yarn config delete proxy + +RUN npm config set registry 'https://registry.npm.taobao.org' + +RUN yarn install + +FROM base AS builder + +RUN apk update && apk add --no-cache git + +ENV OPENAI_API_KEY="" +ENV GOOGLE_API_KEY="" +ENV CODE="" + +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +RUN yarn build + +FROM base AS runner +WORKDIR /app + +RUN apk add proxychains-ng + +ENV PROXY_URL="" +ENV OPENAI_API_KEY="" +ENV GOOGLE_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 \ + export HOSTNAME="127.0.0.1"; \ + protocol=$(echo $PROXY_URL | cut -d: -f1); \ + host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \ + port=$(echo $PROXY_URL | cut -d: -f3); \ + 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 "localnet 127.0.0.0/255.0.0.0" >> $conf; \ + echo "localnet ::1/128" >> $conf; \ + echo "[ProxyList]" >> $conf; \ + echo "$protocol $host $port" >> $conf; \ + cat /etc/proxychains.conf; \ + proxychains -f $conf node server.js; \ + else \ + node server.js; \ + fi From 8a0f5dc4088534373c8be0fde3fd4b8c67b38db9 Mon Sep 17 00:00:00 2001 From: xieyos Date: Mon, 5 Feb 2024 18:55:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=98=E5=AE=9DNPM?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile_CN | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile_CN b/Dockerfile_CN index 6fadbe0de82..811ee31a53d 100644 --- a/Dockerfile_CN +++ b/Dockerfile_CN @@ -10,11 +10,11 @@ WORKDIR /app COPY package.json yarn.lock ./ -RUN yarn config set registry 'https://registry.npm.taobao.org/' +RUN yarn config set registry 'https://registry.npmmirror.com/' RUN yarn config delete proxy -RUN npm config set registry 'https://registry.npm.taobao.org' +RUN npm config set registry 'https://registry.npmmirror.com' RUN yarn install