From 0666c07431707c3d8cdceabb63f99a09b0f2ed74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C3=BBki=20VACHOT?= Date: Sat, 29 Nov 2025 07:18:31 +0100 Subject: [PATCH] Fix Docker --- .dockerignore | 26 +++++--------------------- Dockerfile | 12 ++++++------ docker-compose.prod.yml | 2 -- docker-compose.yml | 22 +++++++++------------- pyproject.toml | 10 ++++++---- 5 files changed, 26 insertions(+), 46 deletions(-) diff --git a/.dockerignore b/.dockerignore index 90a3b64..865ddd4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,12 +8,10 @@ __pycache__/ dist/ build/ *.egg - -# Virtual environments +.venv/ venv/ env/ ENV/ -.venv # IDE .vscode/ @@ -27,11 +25,6 @@ ENV/ .gitignore .gitattributes -# Documentation -*.md -!pyproject.toml -docs/ - # Tests tests/ .pytest_cache/ @@ -45,11 +38,6 @@ htmlcov/ .gitlab-ci.yml .travis.yml -# Environment -.env -.env.local -.env.*.local - # Logs *.log @@ -57,14 +45,10 @@ htmlcov/ .DS_Store Thumbs.db -# Docker -Dockerfile* -docker-compose*.yml -.dockerignore +# Local environment files (keep .env.example if it exists) +.env.local +.env.*.local -# Nginx -nginx/ - -# Data directories (will be mounted as volumes) +# Data directories (will be mounted as volumes in Docker) data/ schemas/ diff --git a/Dockerfile b/Dockerfile index 9314f59..64c43ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,14 +17,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Install uv for faster package installation RUN pip install --no-cache-dir uv -# Copy only dependency files for better layer caching -COPY pyproject.toml . +# Copy only the files needed for dependency installation +COPY README.md pyproject.toml ./ -# Install Python dependencies from pyproject.toml -RUN uv pip install --system --no-cache -e . +# Install Python dependencies +RUN uv pip install --system --no-cache . -# Copy application source code -COPY src/ ./src/ +# Copy the rest of the application +COPY . . # Create data directory for schema cache RUN mkdir -p /app/data/schemas diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 5a5252e..01552e2 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,5 +1,3 @@ -version: '3.8' - # Production deployment with Nginx reverse proxy and SSL support services: diff --git a/docker-compose.yml b/docker-compose.yml index f606b46..a5e275d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,15 +1,11 @@ -version: '3.8' - services: geoguessr-mcp: # Option 1: Build locally build: context: . dockerfile: Dockerfile - # Option 2: Use pre-built image from Docker Hub (uncomment to use) # image: ${DOCKER_USERNAME:-yourusername}/geoguessr-mcp:${IMAGE_TAG:-latest} - container_name: geoguessr-mcp-server restart: unless-stopped ports: @@ -17,24 +13,21 @@ services: environment: # GeoGuessr Authentication (optional - can use login tool instead) - GEOGUESSR_NCFA_COOKIE=${GEOGUESSR_NCFA_COOKIE:-} - # MCP Server configuration - MCP_TRANSPORT=${MCP_TRANSPORT:-streamable-http} - - MCP_HOST=0.0.0.0 - - MCP_PORT=8000 - + - MCP_HOST=${MCP_HOST:-0.0.0.0} + - MCP_PORT=${MCP_PORT:-8000} # Use the same variable as in ports # Monitoring configuration - MONITORING_ENABLED=${MONITORING_ENABLED:-true} - MONITORING_INTERVAL_HOURS=${MONITORING_INTERVAL_HOURS:-24} - - SCHEMA_CACHE_DIR=/app/data/schemas - + - SCHEMA_CACHE_DIR=${SCHEMA_CACHE_DIR:-/app/data/schemas} # Logging - LOG_LEVEL=${LOG_LEVEL:-INFO} volumes: # Persist schema cache between restarts - - geoguessr-schemas:/app/data/schemas + - geoguessr-schemas:${SCHEMA_CACHE_DIR:-/app/data/schemas} healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/health"] + test: [ "CMD", "curl", "-f", "http://localhost:${MCP_PORT:-8000}/health" ] interval: 30s timeout: 10s retries: 3 @@ -44,11 +37,14 @@ services: options: max-size: "10m" max-file: "3" + networks: + - geoguessr-mcp-network volumes: geoguessr-schemas: name: geoguessr-mcp-schemas networks: - default: + geoguessr-mcp-network: name: geoguessr-mcp-network + driver: bridge \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 34ec30c..ac433d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,16 +41,18 @@ dev = [ "pre-commit>=3.6.0", "debugpy>=1.8.0", "ipython>=8.0.0", - "rich>=13.0.0" + "rich>=13.0.0", + "uv>=0.9.0", + "hatch>=1.10.0", ] [project.scripts] geoguessr-mcp = "server:main" [project.urls] -Homepage = "https://github.com/yourusername/geoguessr-mcp" -Repository = "https://github.com/yourusername/geoguessr-mcp" -Issues = "https://github.com/yourusername/geoguessr-mcp/issues" +Homepage = "https://github.com/NyxiumYuuki/GeoGuessrMCP" +Repository = "https://github.com/NyxiumYuuki/GeoGuessrMCP" +Issues = "https://github.com/NyxiumYuuki/GeoGuessrMCP/issues" [build-system] requires = ["hatchling"]