2.2 KiB
Svelte MUD Docker Setup
This guide explains how to use Docker to build and run the Svelte MUD client.
Prerequisites
- Docker
- Docker Compose (usually included with Docker Desktop)
Quick Start
-
Navigate to the project directory:
cd path/to/svelte-mud -
Build and start the containers:
docker-compose up -d -
Access the application:
- Web interface: http://localhost:3000
- WebSocket server: ws://localhost:3001/mud-ws
Docker Commands
Starting the Application
# Build and start in detached mode
docker-compose up -d
# Build and start with logs
docker-compose up
# Force rebuild
docker-compose up --build
Stopping the Application
# Stop containers
docker-compose down
# Stop containers and remove volumes
docker-compose down -v
Viewing Logs
# View all logs
docker-compose logs
# Follow logs
docker-compose logs -f
# View logs for specific service
docker-compose logs -f svelte-mud
Configuration
The Docker setup uses the following ports:
- Port 3000: Web server
- Port 3001: WebSocket server
You can modify these ports in the docker-compose.yml file if needed.
Customization
Environment Variables
You can add environment variables in the docker-compose.yml file:
services:
svelte-mud:
environment:
- NODE_ENV=production
- WS_PORT=3001
# Add your custom environment variables here
Building for Production
The default configuration is optimized for production use. It:
- Uses a multi-stage build process to minimize image size
- Runs as a non-root user for better security
- Includes only production dependencies
Troubleshooting
-
Port conflicts: If ports 3000 or 3001 are already in use, modify the port mappings in
docker-compose.yml. -
Build failures: Ensure that all dependencies are properly defined in your package.json.
-
Connection issues: If you can't connect to the WebSocket server, verify that your client is using the correct URL format:
ws://localhost:3001/mud-ws?host=YOUR_MUD_HOST&port=YOUR_MUD_PORT.