build(docker): add Docker build and deployment infrastructure

- Add multi-stage Dockerfile with pnpm install and Nginx serving
- Add nginx.conf with gzip and SPA fallback
- Add docker-build.sh script for building and pushing images
- Add .dockerignore for build context optimization
- Remove unused pnpm-workspace.yaml
This commit is contained in:
2026-05-25 01:32:51 +08:00
parent 94a432b14d
commit a27d205535
5 changed files with 72 additions and 3 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
set -e
cd "$(dirname "$0")/.."
REGISTRY="${GITEA_REGISTRY:-git.msksbr.com}"
USERNAME="${GITEA_USERNAME:-msksbr}"
IMAGE="$REGISTRY/$USERNAME/bookmgr-client"
VERSION=$(node -e "console.log(require('./package.json').version)")
echo ">>> 版本: $VERSION"
echo ">>> 镜像: $IMAGE"
echo ">>> 构建镜像..."
docker build \
--network=host \
-t "$IMAGE:$VERSION" \
-t "$IMAGE:latest" \
.
echo ">>> 推送镜像..."
docker push "$IMAGE:$VERSION"
docker push "$IMAGE:latest"
echo ""
echo "完成!"
echo " 镜像: $IMAGE:$VERSION"
echo " 镜像: $IMAGE:latest"
echo ""
echo "部署:"
echo " docker run -d -p 80:80 $IMAGE:$VERSION"