Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
4.0 kB · 137 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138#!/usr/bin/env fish# apple-container.fish# Helper script to build, run, and manage Apple Container for aesthetic-computer# Usage: ./apple-container.fish [build|run|start|stop|exec|delete|status]
set -l script_dir (dirname (status filename))set -l containerfile "$script_dir/Containerfile.apple"set -l container_name "ac-dev"set -l image_name "ac-dev"
# Detect workspace path on macOSset -l workspace_path ""if test -d ~/Desktop/code/aesthetic-computer set workspace_path ~/Desktop/code/aesthetic-computerelse if test -d ~/aesthetic-computer set workspace_path ~/aesthetic-computerelse if test -d /workspaces/aesthetic-computer set workspace_path /workspaces/aesthetic-computerelse echo "❌ Could not find aesthetic-computer workspace" echo " Looked in: ~/Desktop/code/aesthetic-computer, ~/aesthetic-computer, /workspaces/aesthetic-computer" exit 1end
function show_help echo "🍎 Apple Container Helper for Aesthetic Computer" echo "" echo "Usage: ./apple-container.fish <command>" echo "" echo "Commands:" echo " build Build the container image from Containerfile.apple" echo " run Create and start a new container (removes existing)" echo " start Start an existing stopped container" echo " stop Stop the running container" echo " exec Execute fish shell in the running container" echo " delete Delete the container" echo " status Show container status" echo " logs Show container logs" echo " generate Regenerate Containerfile.apple from Dockerfile" echo "" echo "Workspace: $workspace_path"end
function cmd_build echo "🔨 Building Apple Container image..." container build -t $image_name -f $containerfile $script_dirend
function cmd_run echo "🚀 Creating and starting container..." # Stop and remove existing container if it exists if container ls -a | grep -q $container_name echo " Removing existing container..." container stop $container_name 2>/dev/null container rm $container_name 2>/dev/null end container create --name $container_name -it --ssh \ -v $workspace_path:/workspaces/aesthetic-computer \ -p 8888:8888 -p 8889:8889 -p 8111:8111 -p 3000:3000 \ -p 8083:8083 -p 8084:8084 -p 8085:8085 \ -w /workspaces/aesthetic-computer \ --cpus 4 --memory 8G \ $image_name /usr/bin/fish container start $container_name echo "✅ Container started! Run './apple-container.fish exec' to enter."end
function cmd_start echo "▶️ Starting container..." container start $container_nameend
function cmd_stop echo "⏹️ Stopping container..." container stop $container_nameend
function cmd_exec echo "🐚 Entering container shell..." container exec -it $container_name /usr/bin/fishend
function cmd_delete echo "🗑️ Deleting container..." container stop $container_name 2>/dev/null container rm $container_nameend
function cmd_status echo "📊 Container status:" container ls -a | head -1 container ls -a | grep $container_name; or echo " No container named '$container_name' found" echo "" if container ls | grep -q $container_name echo "📈 Resource usage:" container stats $container_name --no-stream endend
function cmd_logs container logs $container_nameend
function cmd_generate fish $script_dir/generate-apple-container.fishend
# Mainswitch $argv[1] case build cmd_build case run cmd_run case start cmd_start case stop cmd_stop case exec cmd_exec case delete cmd_delete case status cmd_status case logs cmd_logs case generate cmd_generate case help -h --help "" show_help case "*" echo "❌ Unknown command: $argv[1]" show_help exit 1end