42 lines
975 B
Bash
42 lines
975 B
Bash
#!/bin/bash
|
|
|
|
echo "🐳 Building SiliconFlow API Key Validator Docker image..."
|
|
|
|
# 检查Docker是否已安装
|
|
if ! command -v docker &> /dev/null; then
|
|
echo "❌ Docker is not installed. Please install Docker first."
|
|
exit 1
|
|
fi
|
|
|
|
# 安装依赖
|
|
echo "📦 Installing dependencies..."
|
|
if [ ! -d "node_modules" ]; then
|
|
npm install
|
|
fi
|
|
|
|
if [ ! -d "frontend/node_modules" ]; then
|
|
cd frontend
|
|
npm install
|
|
cd ..
|
|
fi
|
|
|
|
# 构建Docker镜像
|
|
echo "🔨 Building Docker image..."
|
|
docker build -t siliconflow-validator .
|
|
|
|
# 检查构建结果
|
|
if [ $? -eq 0 ]; then
|
|
echo "✅ Docker image built successfully!"
|
|
echo
|
|
echo "🏃♂️ To run the container:"
|
|
echo " docker run -p 3000:3000 siliconflow-validator"
|
|
echo
|
|
echo "🐳 To run with Docker Compose:"
|
|
echo " docker-compose up"
|
|
echo
|
|
echo "🧪 To run development container:"
|
|
echo " docker-compose --profile dev up"
|
|
else
|
|
echo "❌ Docker build failed!"
|
|
exit 1
|
|
fi |