mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-09-22 04:50:46 +02:00
removed reference to an unpublished python package. Corrected a mistyped directory in the dockerhub instructions
This commit is contained in:
parent
3a1dd52796
commit
712cc38ef6
8 changed files with 70 additions and 339 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -15,5 +15,3 @@ non_interactive_test.py
|
|||
test_determinism.py
|
||||
test.py
|
||||
deterministic_test.py
|
||||
build.ps1
|
||||
*.bat
|
|
@ -15,8 +15,12 @@ Intelligent MTG Commander/EDH deck builder with theme detection and automated ca
|
|||
# Create a directory for your decks
|
||||
mkdir mtg-decks && cd mtg-decks
|
||||
|
||||
# Run the application
|
||||
docker run -it --rm -v "$(pwd)":/app/host mwisnowski/mtg-python-deckbuilder:latest
|
||||
# Run the application with proper volume mounting
|
||||
docker run -it --rm \
|
||||
-v "$(pwd)/deck_files":/app/deck_files \
|
||||
-v "$(pwd)/logs":/app/logs \
|
||||
-v "$(pwd)/csv_files":/app/csv_files \
|
||||
mwisnowski/mtg-python-deckbuilder:latest
|
||||
```
|
||||
|
||||
## Features
|
||||
|
@ -34,10 +38,14 @@ docker run -it --rm -v "$(pwd)":/app/host mwisnowski/mtg-python-deckbuilder:late
|
|||
|
||||
## Volume Mounts
|
||||
|
||||
Mount a local directory to `/app/host` to persist your deck files:
|
||||
Mount local directories to the following container paths to persist your data:
|
||||
|
||||
```bash
|
||||
docker run -it --rm -v "$(pwd)":/app/host mwisnowski/mtg-python-deckbuilder:latest
|
||||
docker run -it --rm \
|
||||
-v "$(pwd)/deck_files":/app/deck_files \
|
||||
-v "$(pwd)/logs":/app/logs \
|
||||
-v "$(pwd)/csv_files":/app/csv_files \
|
||||
mwisnowski/mtg-python-deckbuilder:latest
|
||||
```
|
||||
|
||||
Your deck files will be saved to:
|
||||
|
|
BIN
README.md
BIN
README.md
Binary file not shown.
|
@ -50,7 +50,11 @@ This is the first stable release of the MTG Python Deckbuilder - a comprehensive
|
|||
mkdir mtg-decks && cd mtg-decks
|
||||
|
||||
# Run directly from Docker Hub
|
||||
docker run -it --rm -v "$(pwd)":/app/host mwisnowski/mtg-python-deckbuilder:latest
|
||||
docker run -it --rm \
|
||||
-v "$(pwd)/deck_files":/app/deck_files \
|
||||
-v "$(pwd)/logs":/app/logs \
|
||||
-v "$(pwd)/csv_files":/app/csv_files \
|
||||
mwisnowski/mtg-python-deckbuilder:latest
|
||||
```
|
||||
|
||||
### Option 2: Docker from Source (Recommended for Development)
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
# MTG Deckbuilder Docker Runner Script
|
||||
# This script provides easy commands to run the MTG Deckbuilder in Docker with proper volume mounting
|
||||
|
||||
Write-Host "MTG Deckbuilder Docker Helper" -ForegroundColor Green
|
||||
Write-Host "==============================" -ForegroundColor Green
|
||||
|
||||
function Show-Help {
|
||||
Write-Host ""
|
||||
Write-Host "Available commands:" -ForegroundColor Yellow
|
||||
Write-Host " .\run-docker.ps1 build - Build the Docker image"
|
||||
Write-Host " .\run-docker.ps1 run - Run the application with volume mounting"
|
||||
Write-Host " .\run-docker.ps1 compose - Use docker-compose (recommended)"
|
||||
Write-Host " .\run-docker.ps1 clean - Remove containers and images"
|
||||
Write-Host " .\run-docker.ps1 help - Show this help"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Get command line argument
|
||||
$command = $args[0]
|
||||
|
||||
switch ($command) {
|
||||
"build" {
|
||||
Write-Host "Building MTG Deckbuilder Docker image..." -ForegroundColor Yellow
|
||||
docker build -t mtg-deckbuilder .
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Build successful!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Build failed!" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
"run" {
|
||||
Write-Host "Running MTG Deckbuilder with volume mounting..." -ForegroundColor Yellow
|
||||
|
||||
# Ensure local directories exist
|
||||
if (!(Test-Path "deck_files")) { New-Item -ItemType Directory -Path "deck_files" }
|
||||
if (!(Test-Path "logs")) { New-Item -ItemType Directory -Path "logs" }
|
||||
if (!(Test-Path "csv_files")) { New-Item -ItemType Directory -Path "csv_files" }
|
||||
|
||||
# Run with proper volume mounting
|
||||
docker run -it --rm `
|
||||
-v "${PWD}/deck_files:/app/deck_files" `
|
||||
-v "${PWD}/logs:/app/logs" `
|
||||
-v "${PWD}/csv_files:/app/csv_files" `
|
||||
mtg-deckbuilder
|
||||
}
|
||||
|
||||
"compose" {
|
||||
Write-Host "Running MTG Deckbuilder with Docker Compose..." -ForegroundColor Yellow
|
||||
|
||||
# Ensure local directories exist
|
||||
if (!(Test-Path "deck_files")) { New-Item -ItemType Directory -Path "deck_files" }
|
||||
if (!(Test-Path "logs")) { New-Item -ItemType Directory -Path "logs" }
|
||||
if (!(Test-Path "csv_files")) { New-Item -ItemType Directory -Path "csv_files" }
|
||||
|
||||
docker-compose up --build
|
||||
}
|
||||
|
||||
"clean" {
|
||||
Write-Host "Cleaning up Docker containers and images..." -ForegroundColor Yellow
|
||||
docker-compose down 2>$null
|
||||
docker rmi mtg-deckbuilder 2>$null
|
||||
docker system prune -f
|
||||
Write-Host "Cleanup complete!" -ForegroundColor Green
|
||||
}
|
||||
|
||||
"help" {
|
||||
Show-Help
|
||||
}
|
||||
|
||||
default {
|
||||
Write-Host "Invalid command: $command" -ForegroundColor Red
|
||||
Show-Help
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Note: Your deck files, logs, and CSV files will be saved in the local directories" -ForegroundColor Cyan
|
||||
Write-Host "and will persist between Docker runs." -ForegroundColor Cyan
|
252
run-docker.sh
252
run-docker.sh
|
@ -1,252 +0,0 @@
|
|||
#!/bin/bash
|
||||
# MTG Deckbuilder Docker Runner Script for Linux/macOS
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
echo "MTG Deckbuilder Docker Helper (Linux)"
|
||||
echo "====================================="
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colored output
|
||||
print_status() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARN]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
print_debug() {
|
||||
echo -e "${BLUE}[DEBUG]${NC} $1"
|
||||
}
|
||||
|
||||
show_help() {
|
||||
echo ""
|
||||
echo -e "${YELLOW}Available commands:${NC}"
|
||||
echo " ./run-docker-linux.sh setup - Initial setup (create directories, check Docker)"
|
||||
echo " ./run-docker-linux.sh build - Build the Docker image"
|
||||
echo " ./run-docker-linux.sh run - Run with manual volume mounting"
|
||||
echo " ./run-docker-linux.sh compose - Use docker-compose run (recommended for interactive)"
|
||||
echo " ./run-docker-linux.sh compose-build - Build and run with docker-compose"
|
||||
echo " ./run-docker-linux.sh compose-up - Use docker-compose up (not recommended for interactive)"
|
||||
echo " ./run-docker-linux.sh debug - Run with debug info and volume verification"
|
||||
echo " ./run-docker-linux.sh clean - Remove containers and images"
|
||||
echo " ./run-docker-linux.sh help - Show this help"
|
||||
echo ""
|
||||
echo -e "${BLUE}For interactive applications like MTG Deckbuilder:${NC}"
|
||||
echo -e "${BLUE} - Use 'compose' or 'run' commands${NC}"
|
||||
echo -e "${BLUE} - Avoid 'compose-up' as it doesn't handle input properly${NC}"
|
||||
}
|
||||
|
||||
setup_directories() {
|
||||
print_status "Setting up directories..."
|
||||
|
||||
# Create directories with proper permissions
|
||||
mkdir -p deck_files logs csv_files
|
||||
|
||||
# Set permissions to ensure Docker can write
|
||||
chmod 755 deck_files logs csv_files
|
||||
|
||||
print_status "Current directory: $(pwd)"
|
||||
print_status "Directory structure:"
|
||||
ls -la | grep -E "(deck_files|logs|csv_files|^d)"
|
||||
|
||||
echo ""
|
||||
print_status "Directory setup complete!"
|
||||
}
|
||||
|
||||
check_docker() {
|
||||
print_status "Checking Docker installation..."
|
||||
|
||||
if ! command -v docker &> /dev/null; then
|
||||
print_error "Docker is not installed or not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
print_warning "docker-compose not found, trying docker compose..."
|
||||
if ! docker compose version &> /dev/null; then
|
||||
print_error "Neither docker-compose nor 'docker compose' is available"
|
||||
exit 1
|
||||
else
|
||||
COMPOSE_CMD="docker compose"
|
||||
fi
|
||||
else
|
||||
COMPOSE_CMD="docker-compose"
|
||||
fi
|
||||
|
||||
print_status "Docker is available"
|
||||
print_status "Compose command: $COMPOSE_CMD"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"setup")
|
||||
check_docker
|
||||
setup_directories
|
||||
print_status "Setup complete! You can now run: ./run-docker-linux.sh compose"
|
||||
;;
|
||||
|
||||
"build")
|
||||
print_status "Building MTG Deckbuilder Docker image..."
|
||||
docker build -t mtg-deckbuilder .
|
||||
if [ $? -eq 0 ]; then
|
||||
print_status "Build successful!"
|
||||
else
|
||||
print_error "Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
"run")
|
||||
print_status "Running MTG Deckbuilder with manual volume mounting..."
|
||||
|
||||
# Ensure directories exist
|
||||
setup_directories
|
||||
|
||||
print_debug "Volume mounts:"
|
||||
print_debug " $(pwd)/deck_files -> /app/deck_files"
|
||||
print_debug " $(pwd)/logs -> /app/logs"
|
||||
print_debug " $(pwd)/csv_files -> /app/csv_files"
|
||||
|
||||
# Run with proper volume mounting
|
||||
docker run -it --rm \
|
||||
-v "$(pwd)/deck_files:/app/deck_files" \
|
||||
-v "$(pwd)/logs:/app/logs" \
|
||||
-v "$(pwd)/csv_files:/app/csv_files" \
|
||||
-e PYTHONUNBUFFERED=1 \
|
||||
-e TERM=xterm-256color \
|
||||
mtg-deckbuilder
|
||||
;;
|
||||
|
||||
"compose")
|
||||
print_status "Running MTG Deckbuilder with Docker Compose..."
|
||||
|
||||
# Ensure directories exist
|
||||
setup_directories
|
||||
|
||||
# Check for compose command
|
||||
check_docker
|
||||
|
||||
print_debug "Using compose command: $COMPOSE_CMD"
|
||||
print_debug "Working directory: $(pwd)"
|
||||
|
||||
print_status "Starting interactive session..."
|
||||
print_warning "Use Ctrl+C to exit when done"
|
||||
|
||||
# Run with compose in interactive mode
|
||||
$COMPOSE_CMD run --rm mtg-deckbuilder
|
||||
;;
|
||||
|
||||
"compose-build")
|
||||
print_status "Building and running MTG Deckbuilder with Docker Compose..."
|
||||
|
||||
# Ensure directories exist
|
||||
setup_directories
|
||||
|
||||
# Check for compose command
|
||||
check_docker
|
||||
|
||||
print_debug "Using compose command: $COMPOSE_CMD"
|
||||
print_debug "Working directory: $(pwd)"
|
||||
|
||||
print_status "Building image and starting interactive session..."
|
||||
print_warning "Use Ctrl+C to exit when done"
|
||||
|
||||
# Build and run with compose in interactive mode
|
||||
$COMPOSE_CMD build
|
||||
$COMPOSE_CMD run --rm mtg-deckbuilder
|
||||
;;
|
||||
|
||||
"compose-up")
|
||||
print_status "Running MTG Deckbuilder with Docker Compose UP (not recommended for interactive apps)..."
|
||||
|
||||
# Ensure directories exist
|
||||
setup_directories
|
||||
|
||||
# Check for compose command
|
||||
check_docker
|
||||
|
||||
print_debug "Using compose command: $COMPOSE_CMD"
|
||||
print_debug "Working directory: $(pwd)"
|
||||
|
||||
print_warning "This may not work properly for interactive applications!"
|
||||
print_warning "Use 'compose' command instead for better interactivity"
|
||||
|
||||
# Run with compose
|
||||
$COMPOSE_CMD up --build
|
||||
;;
|
||||
|
||||
"debug")
|
||||
print_status "Running in debug mode..."
|
||||
|
||||
setup_directories
|
||||
|
||||
print_debug "=== DEBUG INFO ==="
|
||||
print_debug "Current user: $(whoami)"
|
||||
print_debug "Current directory: $(pwd)"
|
||||
print_debug "Directory permissions:"
|
||||
ls -la deck_files logs csv_files 2>/dev/null || print_warning "Some directories don't exist yet"
|
||||
|
||||
print_debug "=== DOCKER INFO ==="
|
||||
docker --version
|
||||
docker info | grep -E "(Operating System|Architecture)"
|
||||
|
||||
print_debug "=== RUNNING CONTAINER ==="
|
||||
docker run -it --rm \
|
||||
-v "$(pwd)/deck_files:/app/deck_files" \
|
||||
-v "$(pwd)/logs:/app/logs" \
|
||||
-v "$(pwd)/csv_files:/app/csv_files" \
|
||||
-e PYTHONUNBUFFERED=1 \
|
||||
-e TERM=xterm-256color \
|
||||
mtg-deckbuilder /bin/bash -c "
|
||||
echo 'Container info:'
|
||||
echo 'Working dir: \$(pwd)'
|
||||
echo 'Mount points:'
|
||||
ls -la /app/
|
||||
echo 'Testing file creation:'
|
||||
touch /app/deck_files/test_file.txt
|
||||
echo 'File created: \$(ls -la /app/deck_files/test_file.txt)'
|
||||
echo 'Starting application...'
|
||||
python main.py
|
||||
"
|
||||
;;
|
||||
|
||||
"clean")
|
||||
print_status "Cleaning up Docker containers and images..."
|
||||
|
||||
check_docker
|
||||
|
||||
# Stop and remove containers
|
||||
$COMPOSE_CMD down 2>/dev/null || true
|
||||
docker stop mtg-deckbuilder 2>/dev/null || true
|
||||
docker rm mtg-deckbuilder 2>/dev/null || true
|
||||
|
||||
# Remove image
|
||||
docker rmi mtg-deckbuilder 2>/dev/null || true
|
||||
|
||||
# Clean up unused resources
|
||||
docker system prune -f
|
||||
|
||||
print_status "Cleanup complete!"
|
||||
;;
|
||||
|
||||
"help"|*)
|
||||
show_help
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo -e "${BLUE}Note: Your deck files, logs, and CSV files will be saved in:${NC}"
|
||||
echo -e "${BLUE} $(pwd)/deck_files${NC}"
|
||||
echo -e "${BLUE} $(pwd)/logs${NC}"
|
||||
echo -e "${BLUE} $(pwd)/csv_files${NC}"
|
27
run-from-dockerhub.bat
Normal file
27
run-from-dockerhub.bat
Normal file
|
@ -0,0 +1,27 @@
|
|||
@echo off
|
||||
echo MTG Python Deckbuilder - Docker Hub Runner
|
||||
echo ===========================================
|
||||
|
||||
REM Create directories if they don't exist
|
||||
if not exist "deck_files" mkdir deck_files
|
||||
if not exist "logs" mkdir logs
|
||||
if not exist "csv_files" mkdir csv_files
|
||||
|
||||
echo Starting MTG Python Deckbuilder from Docker Hub...
|
||||
echo Your files will be saved in the current directory:
|
||||
echo - deck_files\: Your completed decks
|
||||
echo - logs\: Application logs
|
||||
echo - csv_files\: Card database files
|
||||
echo.
|
||||
|
||||
REM Run the Docker container with proper volume mounts
|
||||
docker run -it --rm ^
|
||||
-v "%cd%\deck_files:/app/deck_files" ^
|
||||
-v "%cd%\logs:/app/logs" ^
|
||||
-v "%cd%\csv_files:/app/csv_files" ^
|
||||
mwisnowski/mtg-python-deckbuilder:latest
|
||||
|
||||
echo.
|
||||
echo MTG Python Deckbuilder session ended.
|
||||
echo Your files are saved in: %cd%
|
||||
pause
|
25
run-from-dockerhub.sh
Normal file
25
run-from-dockerhub.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "MTG Python Deckbuilder - Docker Hub Runner"
|
||||
echo "==========================================="
|
||||
|
||||
# Create directories if they don't exist
|
||||
mkdir -p deck_files logs csv_files
|
||||
|
||||
echo "Starting MTG Python Deckbuilder from Docker Hub..."
|
||||
echo "Your files will be saved in the current directory:"
|
||||
echo " - deck_files/: Your completed decks"
|
||||
echo " - logs/: Application logs"
|
||||
echo " - csv_files/: Card database files"
|
||||
echo
|
||||
|
||||
# Run the Docker container with proper volume mounts
|
||||
docker run -it --rm \
|
||||
-v "$(pwd)/deck_files":/app/deck_files \
|
||||
-v "$(pwd)/logs":/app/logs \
|
||||
-v "$(pwd)/csv_files":/app/csv_files \
|
||||
mwisnowski/mtg-python-deckbuilder:latest
|
||||
|
||||
echo
|
||||
echo "MTG Python Deckbuilder session ended."
|
||||
echo "Your files are saved in: $(pwd)"
|
Loading…
Add table
Add a link
Reference in a new issue