better building

This commit is contained in:
Mikan
2026-10-17 19:04:20 +04:00
parent fbff0edf77
commit 7009636535
4 changed files with 45 additions and 15 deletions

View File

@@ -14,8 +14,19 @@ echo Windows path: %WIN_DIR%
echo WSL path: %WSL_DIR%
echo.
echo Building images...
wsl bash -c "cd '%WSL_DIR%' && sh build.sh"
if errorlevel 1 (
echo.
echo ERROR: Image build failed.
pause
exit /b 1
)
echo.
echo Starting Docker services via WSL...
wsl bash -c "cd '%WSL_DIR%' && docker compose up --build -d"
wsl bash -c "cd '%WSL_DIR%' && docker compose up -d"
if errorlevel 1 (
echo.

23
build.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
set -eu
IMAGE_SSH="gpu-node-ssh"
IMAGE_MODEL_WORKER="gpu-node-model-worker"
IMAGE_GPU_TEST="gpu-node-gpu-test"
echo "==> Building SSH image..."
docker build -t "$IMAGE_SSH" ./ssh
echo "==> Building Model Worker image..."
docker build -t "$IMAGE_MODEL_WORKER" ./model-worker
echo "==> Building GPU Test image..."
if [ -f "./gpu/Dockerfile" ]; then
docker build -t "$IMAGE_GPU_TEST" ./gpu
else
echo " Skipped (no ./gpu/Dockerfile found)"
fi
echo "==> Build complete."
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}\t{{.CreatedSince}}" \
| grep -E "gpu-node-|REPOSITORY" || true

View File

@@ -20,8 +20,7 @@ services:
- "node.instance=${TAILSCALE_HOSTNAME:-gpu-node}"
ssh:
build:
context: ./ssh
image: gpu-node-ssh
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-ssh-main
hostname: ssh-main
environment:
@@ -42,8 +41,7 @@ services:
ssh-companion:
profiles:
- wake
build:
context: ./ssh
image: gpu-node-ssh
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-ssh-companion
hostname: ssh-companion
environment:
@@ -89,8 +87,7 @@ services:
gpu-test:
profiles:
- test
build:
context: ./gpu
image: gpu-node-gpu-test
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-gpu-test
gpus: all
networks:
@@ -103,8 +100,7 @@ services:
model-worker:
profiles:
- wake
build:
context: ./model-worker
image: gpu-node-model-worker
container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-model-worker
volumes:
- ${HOST_PROJECT_PATH:-./}/gpu/comfy/models:/models
@@ -162,4 +158,4 @@ services:
networks:
gpu-node:
name: ${TAILSCALE_HOSTNAME:-gpu-node}
name: ${TAILSCALE_HOSTNAME:-gpu-node}

View File

@@ -28,13 +28,16 @@ update_ssh() {
echo "Current SSH role: $SSH_ROLE"
echo "Node instance: $NODE_INSTANCE"
echo "Host project: $HOST_PROJECT_PATH"
echo "Updating: $TARGET_SSH_SERVICE + model-worker"
echo "Rebuilding images..."
sh "$PROJECT_DIR/build.sh"
echo "Restarting: $TARGET_SSH_SERVICE + model-worker"
HOST_PROJECT_PATH="$HOST_PROJECT_PATH" \
docker compose \
-f "$COMPOSE_FILE" \
up -d \
--build \
--force-recreate \
"$TARGET_SSH_SERVICE" \
model-worker
@@ -70,7 +73,6 @@ logs_service() {
container_is_running() {
TARGET="$1"
# Если передали роль — резолвим в имя контейнера
RESOLVED=$(get_service_container "$TARGET" 2>/dev/null) || true
if [ -n "$RESOLVED" ]; then
TARGET="$RESOLVED"
@@ -111,13 +113,11 @@ sleep_mode() {
echo "Entering sleep mode for instance: $NODE_INSTANCE"
echo "Keeping: tailscale + $KEEP_SSH_ROLE"
# Удаляем опциональные контейнеры ТОЛЬКО своего инстанса
for ROLE in llama comfyui gpu-test model-worker webdav; do
CTR=$(get_service_container "$ROLE" 2>/dev/null) || true
[ -n "$CTR" ] && docker rm -f "$CTR" 2>/dev/null || true
done
# Удаляем ненужный SSH-контейнер
REMOVE_CTR=$(get_service_container "$REMOVE_SSH_ROLE" 2>/dev/null) || true
[ -n "$REMOVE_CTR" ] && docker rm -f "$REMOVE_CTR" 2>/dev/null || true