feat:优化打包

v3.2
panyy 2026-07-06 19:54:32 +08:00
parent b4c97ab937
commit 4b4079d96f
4 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,8 @@
FROM nginx:alpine
ENV KB_UPSTREAM=http://airag:8080
ENV MINDMAP_UPSTREAM=http://mindmap-web:9898
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
EXPOSE 8989
CMD ["nginx", "-g", "daemon off;"]

View File

@ -0,0 +1,32 @@
server {
listen 8989;
server_name localhost;
client_max_body_size 100M;
location = /mindmap {
return 301 /mindmap/;
}
location ^~ /mindmap/ {
proxy_pass ${MINDMAP_UPSTREAM};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
}
location / {
proxy_pass ${KB_UPSTREAM};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
}
}

View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
VERSION=${VERSION:-$(date +%Y%m%d%H%M%S)}
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
cd "$ROOT_DIR"
echo "Building UnisKB image: unis-kb:${VERSION}"
sudo docker build -f installer/Dockerfile \
--build-arg DOCKER_IMAGE_TAG="${VERSION}" \
--build-arg BUILD_AT="$(date -u +%Y%m%dT%H%M%SZ)" \
--build-arg GITHUB_COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)" \
-t unis-kb:${VERSION} \
-t unis-kb:latest \
-t airag:latest \
.
echo "Building gateway image: unis-gateway:${VERSION}"
sudo docker build -f deploy/gateway/Dockerfile \
-t unis-gateway:${VERSION} \
-t unis-gateway:latest \
deploy/gateway

View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
NETWORK=${NETWORK:-unis-ai}
KB_DATA_DIR=${KB_DATA_DIR:-/opt/maxkb}
MINDMAP_URL=${MINDMAP_URL:-/mindmap/}
GATEWAY_PORT=${GATEWAY_PORT:-8989}
sudo docker network create "$NETWORK" >/dev/null 2>&1 || true
sudo mkdir -p "$KB_DATA_DIR"
sudo chmod -R 777 "$KB_DATA_DIR"
sudo docker rm -f airag unis-gateway >/dev/null 2>&1 || true
sudo docker run -d --name airag --network "$NETWORK" \
-v "${KB_DATA_DIR}:/opt/maxkb" \
-e MAXKB_MINDMAP_URL="$MINDMAP_URL" \
unis-kb:latest
sudo docker run -d --name unis-gateway --network "$NETWORK" \
-p "${GATEWAY_PORT}:8989" \
-e KB_UPSTREAM=http://airag:8080 \
-e MINDMAP_UPSTREAM=http://mindmap-web:9898 \
unis-gateway:latest