-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
100 lines (88 loc) · 3.55 KB
/
Copy pathdocker-compose.yml
File metadata and controls
100 lines (88 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
version: "3.9"
# =============================================================================
# Modded Minecraft Server – Docker Compose
# =============================================================================
# Usage:
# docker compose up -d Start the server
# docker compose down Stop the server
# docker compose logs -f Follow logs
# docker compose exec mc rcon-cli Interactive RCON console
# =============================================================================
services:
mc:
build:
context: ./docker
dockerfile: Dockerfile
container_name: minecraft_server
restart: unless-stopped
# -------------------------------------------------------------------------
# Environment
# -------------------------------------------------------------------------
env_file:
- .env
environment:
# itzg/minecraft-server variables
EULA: "TRUE"
TYPE: FORGE
VERSION: ${MINECRAFT_VERSION:-1.20.1}
MEMORY: ${MEMORY:-8G}
USE_AIKAR_FLAGS: "true"
JVM_XX_OPTS: ${JAVA_FLAGS:-}
# Server settings
DIFFICULTY: ${DIFFICULTY:-normal}
MAX_PLAYERS: ${MAX_PLAYERS:-8}
VIEW_DISTANCE: ${VIEW_DISTANCE:-8}
SIMULATION_DISTANCE: ${SIMULATION_DISTANCE:-6}
SERVER_NAME: ${SERVER_NAME:-Modded Minecraft Server}
OPS: ${OPS:-}
WHITELIST: ${WHITELIST:-}
ENABLE_WHITELIST: ${ENABLE_WHITELIST:-FALSE}
ONLINE_MODE: ${ONLINE_MODE:-true}
# RCON (used by backup/stop scripts)
ENABLE_RCON: "true"
RCON_PORT: ${RCON_PORT:-25575}
RCON_PASSWORD: ${RCON_PASSWORD:-changeme_rcon_password}
# Modpack auto-install (handled by entrypoint)
MODPACK_TYPE: ${MODPACK_TYPE:-ragnamod7sky}
MODPACK_URL: ${MODPACK_URL:-}
# Override UID/GID for file ownership
PUID: ${UID:-1000}
PGID: ${GID:-1000}
# -------------------------------------------------------------------------
# Ports
# -------------------------------------------------------------------------
ports:
- "${SERVER_PORT:-25565}:25565/tcp"
- "${SERVER_PORT:-25565}:25565/udp"
- "${RCON_PORT:-25575}:25575"
# -------------------------------------------------------------------------
# Volumes
# ./server-files → /data inside container (Minecraft working directory)
# ./backups → /backups inside container
# -------------------------------------------------------------------------
volumes:
- ./server-files:/data
- ./backups:/backups
- ./config/server.properties:/data/server.properties:ro
# -------------------------------------------------------------------------
# Healthcheck – pings the RCON port every 30 s
# -------------------------------------------------------------------------
healthcheck:
test:
["CMD-SHELL", "rcon-cli --port \"$$RCON_PORT\" --password \"$$RCON_PASSWORD\" list >/dev/null 2>&1 || exit 1"]
interval: 60s
timeout: 10s
retries: 3
start_period: 600s
# -------------------------------------------------------------------------
# Resources (adjust for your host)
# -------------------------------------------------------------------------
mem_limit: ${MEMORY_LIMIT:-14G}
# -------------------------------------------------------------------------
# Logging – keep last 50 MB, rotate after 10 MB
# -------------------------------------------------------------------------
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"