Files
msksbr a27d205535 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
2026-05-25 01:32:51 +08:00

32 lines
656 B
Bash
Executable File

#!/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"