-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
81 lines (72 loc) · 2.7 KB
/
Copy pathdocker-compose.yml
File metadata and controls
81 lines (72 loc) · 2.7 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
# 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 '</dev/tcp/localhost/25565' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 120s
# Security options
security_opt:
- no-new-privileges:true
# Logging configuration to prevent disk filling
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"