mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-02 08:06:38 +08:00
test pack
This commit is contained in:
parent
51e1fdf366
commit
6a004421fc
2
.github/workflows/dockerToHub-dev.yml
vendored
2
.github/workflows/dockerToHub-dev.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
echo ${{ secrets.ALY_DOCKER_PASSWORD }} | docker login registry.cn-hangzhou.aliyuncs.com -u ${{ secrets.ALY_DOCKER_USERNAME }} --password-stdin
|
||||
echo "${{ secrets.DOCKER_ENV }}" > .env
|
||||
echo "COMPOSE_PROJECT_NAME=test-chatgpt-web" >> .env
|
||||
bash ./start.sh
|
||||
#bash ./start.sh
|
||||
# 替换测试镜像
|
||||
sed -i 's@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web:test@g' docker-compose.yml
|
||||
sed -i 's|23000:|23001:|g' docker-compose.yml
|
||||
|
109
.github/workflows/dockerToHub-dev.yml.bak
vendored
Normal file
109
.github/workflows/dockerToHub-dev.yml.bak
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
name: DEV DEPLOY TO TX
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# branches:
|
||||
# - dev
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build test image to aly
|
||||
# runs-on: thinkpad
|
||||
runs-on: self
|
||||
# runs-on: self-hosted
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'dev'
|
||||
clean: false
|
||||
github-server-url: 'https://gh.siji.ci'
|
||||
- name: build and deploy to Docker Hub
|
||||
run: |
|
||||
echo ${{ secrets.ALY_DOCKER_PASSWORD }} | docker login registry.cn-hangzhou.aliyuncs.com -u ${{ secrets.ALY_DOCKER_USERNAME }} --password-stdin
|
||||
echo "${{ secrets.DOCKER_ENV }}" > .env
|
||||
echo "COMPOSE_PROJECT_NAME=test-chatgpt-web" >> .env
|
||||
bash ./start.sh
|
||||
# 替换测试镜像
|
||||
sed -i 's@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web:test@g' docker-compose.yml
|
||||
sed -i 's|23000:|23001:|g' docker-compose.yml
|
||||
docker-compose build
|
||||
docker-compose push
|
||||
yes | docker system prune --filter "until=168h"
|
||||
deploy:
|
||||
name: 部署到dev服务器
|
||||
runs-on: self
|
||||
needs: build
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
clean: true
|
||||
ref: 'dev'
|
||||
github-server-url: 'https://gh.siji.ci'
|
||||
- name: Set up SSH key
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
- name: Sync repository to tx
|
||||
run: |
|
||||
yes | docker image prune
|
||||
ssh -o StrictHostKeyChecking=no -p${{ secrets.SSH_PORT }} root@${{ secrets.TX_SSH_IP }} 'mkdir -p /data/test/ChatGPT-Next-Web'
|
||||
rsync -az -e 'ssh -o StrictHostKeyChecking=no -p${{ secrets.SSH_PORT }}' --delete $GITHUB_WORKSPACE/ root@tx.xiaosi.cc:/data/test/ChatGPT-Next-Web
|
||||
- name: deploy-to-tx
|
||||
uses: appleboy/ssh-action@master
|
||||
env:
|
||||
SERVER_WORKDIR: ${{ secrets.SERVER_WORKDIR }} #传递工作目录变量
|
||||
with:
|
||||
host: ${{ secrets.TX_SSH_IP }} #服务器地址
|
||||
username: root #用户名
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }} #私钥 安全问题一定都以变量的方式传递!!!
|
||||
envs: SERVER_WORKDIR,ALY_DOCKER_PASSWORD,ALY_DOCKER_USERNAME,DOCKER_ENV #使用工作目录变量
|
||||
script: |
|
||||
cd /data/test/ChatGPT-Next-Web
|
||||
echo "${{ secrets.DOCKER_ENV }}" > .env
|
||||
# 测试分支,
|
||||
echo "COMPOSE_PROJECT_NAME=test-chatgpt-web" >> .env
|
||||
sed -i 's@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web:test@g' docker-compose.yml
|
||||
echo ${{ secrets.ALY_DOCKER_PASSWORD }} | docker login registry.cn-hangzhou.aliyuncs.com -u ${{ secrets.ALY_DOCKER_USERNAME }} --password-stdin
|
||||
sed -i 's|23000:|23001:|g' docker-compose.yml
|
||||
sed -i 's|container_name:|#container_name:|g' docker-compose.yml
|
||||
docker network ls | grep -qw chatgpt-ns || docker network create chatgpt-ns
|
||||
docker-compose pull && docker-compose up -d
|
||||
yes | docker image prune
|
||||
rm -rf /www/server/nginx/proxy_cache_dir/* || true
|
||||
rm -rf /www/server/nginx/proxy_temp_dir/* || true
|
||||
|
||||
|
||||
- name: Sync repository to xy-nm
|
||||
run: |
|
||||
yes | docker image prune
|
||||
ssh -o StrictHostKeyChecking=no -p${{ secrets.SSH_PORT }} root@${{ secrets.NM_SSH_IP }} 'mkdir -p /data/test/ChatGPT-Next-Web'
|
||||
rsync -az -e 'ssh -o StrictHostKeyChecking=no -p${{ secrets.SSH_PORT }}' --delete $GITHUB_WORKSPACE/ root@xy-nm.xiaosi.cc:/data/test/ChatGPT-Next-Web
|
||||
- name: deploy-to-xy-nm
|
||||
uses: appleboy/ssh-action@master
|
||||
env:
|
||||
SERVER_WORKDIR: ${{ secrets.SERVER_WORKDIR }} #传递工作目录变量
|
||||
with:
|
||||
host: ${{ secrets.NM_SSH_IP }} #服务器地址
|
||||
username: root #用户名
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }} #私钥 安全问题一定都以变量的方式传递!!!
|
||||
envs: SERVER_WORKDIR,ALY_DOCKER_PASSWORD,ALY_DOCKER_USERNAME,DOCKER_ENV #使用工作目录变量
|
||||
script: |
|
||||
cd /data/test/ChatGPT-Next-Web
|
||||
echo "${{ secrets.DOCKER_ENV }}" > .env
|
||||
# 测试分支,
|
||||
echo "COMPOSE_PROJECT_NAME=test-chatgpt-web" >> .env
|
||||
sed -i 's@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web@image: registry.cn-hangzhou.aliyuncs.com/si-private/chatgpt-next-web:test@g' docker-compose.yml
|
||||
echo ${{ secrets.ALY_DOCKER_PASSWORD }} | docker login registry.cn-hangzhou.aliyuncs.com -u ${{ secrets.ALY_DOCKER_USERNAME }} --password-stdin
|
||||
sed -i 's|23000:|23001:|g' docker-compose.yml
|
||||
sed -i 's|container_name:|#container_name:|g' docker-compose.yml
|
||||
docker network ls | grep -qw chatgpt-ns || docker network create chatgpt-ns
|
||||
docker-compose pull && docker-compose up -d
|
||||
yes | docker image prune
|
||||
rm -rf /www/server/nginx/proxy_cache_dir/* || true
|
||||
rm -rf /www/server/nginx/proxy_temp_dir/* || true
|
||||
|
||||
|
91
Dockerfile
91
Dockerfile
@ -1,59 +1,60 @@
|
||||
#FROM registry.cn-hangzhou.aliyuncs.com/sijinhui/node:18-alpine AS base
|
||||
FROM hub.siji.ci/library/node:20-alpine AS base
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
RUN apk update && apk add --no-cache git tzdata
|
||||
RUN apk update && apk add --no-cache git tzdata vips-dev
|
||||
# 设置时区环境变量
|
||||
ENV TZ=Asia/Chongqing
|
||||
# 更新并安装时区工具
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
#FROM base AS deps
|
||||
#RUN apk add --no-cache libc6-compat g++ make
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
#COPY package.json ./
|
||||
#
|
||||
#RUN yarn config set registry 'https://registry.npmmirror.com/'
|
||||
#RUN yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
|
||||
#RUN yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat g++ make
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json ./
|
||||
|
||||
RUN yarn config set registry 'https://registry.npmmirror.com/'
|
||||
RUN yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
|
||||
RUN yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
|
||||
#RUN # 清理遗留的缓存
|
||||
#RUN yarn cache clean
|
||||
#RUN yarn install
|
||||
#
|
||||
## 避免下面那个报错
|
||||
#RUN mkdir -p "/app/node_modules/tiktoken"
|
||||
#
|
||||
#FROM base AS builder
|
||||
#
|
||||
#ENV OPENAI_API_KEY=""
|
||||
#ENV GOOGLE_API_KEY=""
|
||||
#ENV CODE=""
|
||||
#
|
||||
#WORKDIR /app
|
||||
#COPY . .
|
||||
#COPY --from=deps /app/node_modules ./node_modules
|
||||
#
|
||||
#RUN yarn build
|
||||
#
|
||||
RUN yarn cache clean
|
||||
RUN yarn install
|
||||
|
||||
FROM base AS builder
|
||||
|
||||
ENV OPENAI_API_KEY=""
|
||||
ENV GOOGLE_API_KEY=""
|
||||
ENV CODE=""
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
# 避免下面那个报错
|
||||
RUN mkdir -p "/app/node_modules/tiktoken"
|
||||
RUN mkdir -p "/app/node_modules/sharp"
|
||||
|
||||
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
|
||||
#
|
||||
## 一个插件一直有问题。
|
||||
#COPY --from=deps /app/node_modules/tiktoken ./node_modules/tiktoken
|
||||
COPY out/ .
|
||||
|
||||
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
|
||||
|
||||
# 一个插件一直有问题。
|
||||
COPY --from=builder /app/node_modules/tiktoken ./node_modules/tiktoken
|
||||
COPY --from=builder /app/node_modules/sharp ./node_modules/sharp
|
||||
#COPY out/ .
|
||||
|
||||
RUN rm -f .env
|
||||
|
||||
|
83
Dockerfile.linux-build
Normal file
83
Dockerfile.linux-build
Normal file
@ -0,0 +1,83 @@
|
||||
#FROM registry.cn-hangzhou.aliyuncs.com/sijinhui/node:18-alpine AS base
|
||||
FROM hub.siji.ci/library/node:20-alpine AS base
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
RUN apk update && apk add --no-cache git tzdata
|
||||
# 设置时区环境变量
|
||||
ENV TZ=Asia/Chongqing
|
||||
# 更新并安装时区工具
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
#FROM base AS deps
|
||||
#RUN apk add --no-cache libc6-compat g++ make
|
||||
#
|
||||
#WORKDIR /app
|
||||
#
|
||||
#COPY package.json ./
|
||||
#
|
||||
#RUN yarn config set registry 'https://registry.npmmirror.com/'
|
||||
#RUN yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
|
||||
#RUN yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
|
||||
#RUN # 清理遗留的缓存
|
||||
#RUN yarn cache clean
|
||||
#RUN yarn install
|
||||
#
|
||||
## 避免下面那个报错
|
||||
#RUN mkdir -p "/app/node_modules/tiktoken"
|
||||
#
|
||||
#FROM base AS builder
|
||||
#
|
||||
#ENV OPENAI_API_KEY=""
|
||||
#ENV GOOGLE_API_KEY=""
|
||||
#ENV CODE=""
|
||||
#
|
||||
#WORKDIR /app
|
||||
#COPY . .
|
||||
#COPY --from=deps /app/node_modules ./node_modules
|
||||
#
|
||||
#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
|
||||
#
|
||||
## 一个插件一直有问题。
|
||||
#COPY --from=deps /app/node_modules/tiktoken ./node_modules/tiktoken
|
||||
COPY out/ .
|
||||
|
||||
RUN rm -f .env
|
||||
|
||||
EXPOSE 3000
|
||||
ENV KEEP_ALIVE_TIMEOUT=30
|
||||
ENV HOSTNAME=""
|
||||
|
||||
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
|
@ -1,4 +1,12 @@
|
||||
import webpack from "webpack";
|
||||
// debug build
|
||||
import { createRequire } from 'module';
|
||||
const require = createRequire(import.meta.url);
|
||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||
enabled: process.env.ANALYZE === 'true',
|
||||
});
|
||||
|
||||
|
||||
// import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
||||
const mode = process.env.BUILD_MODE ?? "standalone";
|
||||
console.log("[Next] build mode", mode);
|
||||
@ -11,7 +19,7 @@ console.log("[Next] build with chunk: ", disableChunk);
|
||||
// const isProd = process.env.NODE_ENV === 'production'
|
||||
|
||||
// 为了修复tiktoken的插件问题
|
||||
const nextConfig = {
|
||||
const nextConfig = withBundleAnalyzer({
|
||||
// transpilePackages: ['tiktoken'],
|
||||
webpack(config) {
|
||||
config.module.rules.push({
|
||||
@ -81,8 +89,11 @@ const nextConfig = {
|
||||
experimental: {
|
||||
forceSwcTransforms: true,
|
||||
},
|
||||
// externals: {
|
||||
// 'sharp': 'commonjs sharp'
|
||||
// },
|
||||
swcMinify: true,
|
||||
};
|
||||
});
|
||||
|
||||
const CorsHeaders = [
|
||||
{ key: "Access-Control-Allow-Credentials", value: "true" },
|
||||
|
@ -59,6 +59,7 @@
|
||||
"zustand": "^4.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/bundle-analyzer": "^14.2.3",
|
||||
"@tauri-apps/cli": "1.5.11",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/cookie": "^0.6.0",
|
||||
@ -82,6 +83,7 @@
|
||||
"prettier": "^3.2.4",
|
||||
"prettier-plugin-tailwindcss": "^0.5.11",
|
||||
"prisma": "^5.13.0",
|
||||
"speed-measure-webpack-plugin": "^1.5.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript": "^5.3.3",
|
||||
|
Loading…
Reference in New Issue
Block a user