mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-02 04:20:50 +08:00
Refactor docker-compose config for simplicity and consistency
This commit is contained in:
@@ -7,15 +7,21 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# --- Step 1: Choose Environment ---
|
||||
Write-Host "Please select your environment:"
|
||||
Write-Host "1) Local Development (Build and Run)"
|
||||
Write-Host "2) Remote Deployment (Run from Image)"
|
||||
Write-Host "Please select an option:"
|
||||
Write-Host "1) Run using Pre-built Image (Recommended)"
|
||||
Write-Host "2) Build from Source and Run (For Developers)"
|
||||
$choice = Read-Host -Prompt "Enter choice [1-2]"
|
||||
|
||||
# --- Step 2: Execute based on choice ---
|
||||
switch ($choice) {
|
||||
"1" {
|
||||
Write-Host "--- Starting Local Development Environment ---"
|
||||
Write-Host "--- Running with Pre-built Image ---"
|
||||
docker compose up -d --remove-orphans --no-build
|
||||
Write-Host "Services are starting from remote image."
|
||||
Write-Host "Run 'docker compose logs -f' to see the logs."
|
||||
}
|
||||
"2" {
|
||||
Write-Host "--- Building from Source and Running ---"
|
||||
|
||||
# Get Version Information
|
||||
$VERSION = (git describe --tags --always --dirty)
|
||||
@@ -28,21 +34,18 @@ switch ($choice) {
|
||||
Write-Host " Build Date: $BUILD_DATE"
|
||||
Write-Host "----------------------------------------"
|
||||
|
||||
# Build the Docker Image
|
||||
# Build and start the services with a local-only image tag
|
||||
$env:CLI_PROXY_IMAGE = "cli-proxy-api:local"
|
||||
|
||||
Write-Host "Building the Docker image..."
|
||||
docker compose build --build-arg VERSION=$VERSION --build-arg COMMIT=$COMMIT --build-arg BUILD_DATE=$BUILD_DATE
|
||||
|
||||
# Start the Services
|
||||
docker compose up -d --remove-orphans
|
||||
Write-Host "Starting the services..."
|
||||
docker compose up -d --remove-orphans --pull never
|
||||
|
||||
Write-Host "Build complete. Services are starting."
|
||||
Write-Host "Run 'docker compose logs -f' to see the logs."
|
||||
}
|
||||
"2" {
|
||||
Write-Host "--- Starting Remote Deployment Environment ---"
|
||||
docker compose -f docker-compose.yml -f docker-compose.remote.yml up -d
|
||||
Write-Host "Services are starting from remote image."
|
||||
Write-Host "Run 'docker compose logs -f' to see the logs."
|
||||
}
|
||||
default {
|
||||
Write-Host "Invalid choice. Please enter 1 or 2."
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user