# Modern Compose specification (version field is optional and no longer recommended) services: minecraft: build: context: ./docker dockerfile: Dockerfile # BuildKit args for potential future use args: - BUILDKIT_INLINE_CACHE=1 container_name: minecraft-server restart: unless-stopped # Mount server directory and overlay secondfry-start.sh # Place your Minecraft server files in ./server/ directory # secondfry-start.sh is automatically injected at runtime (no need to preserve it) volumes: - ./server:/server - ./secondfry-start.sh:/server/secondfry-start.sh:ro # Expose Minecraft ports ports: - "25565:25565" # Minecraft server port # RCON port (disabled by default for security) # Uncomment only if you need remote console access: # - "25575:25575" # Environment variables # All configuration lives in .env (copy from .env.example). # env_file injects every variable in .env as a container env var, # so adding a new knob only requires editing .env — no compose edit. # required: false lets the service start even without a .env file # (Alpine defaults TZ to UTC when unset). env_file: - path: .env required: false # Resource limits (OPTIONAL - commented out by default) # # By default, Docker containers can use ALL host RAM without limits. # The startup script auto-detects available RAM from the host/container. # # Use cases for setting memory limits: # 1. Multi-tenant hosts - prevent one container from starving others # 2. Shared hosting - enforce resource quotas per customer # 3. Testing - simulate lower-memory environments # # NOTE: If you set a limit, the auto-detection will see ONLY that limit, # not the host's total RAM. For example, with "memory: 8G", the script # detects 8G and allocates ~6G heap (leaving 2G overhead). # # deploy: # resources: # limits: # memory: 8G # Maximum RAM container can use # reservations: # memory: 6G # Minimum RAM to guarantee # stdin_open and tty for interactive console (optional) stdin_open: true tty: true # Healthcheck to monitor server status # Uses bash's built-in /dev/tcp for TCP port checking (no netcat required) healthcheck: test: ["CMD-SHELL", "timeout 5 bash -c '