Created
July 2, 2024 00:05
-
-
Save cwagdev/3dca47810f6aa6e0553aaf4ddeac4512 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
mc: | |
image: itzg/minecraft-server | |
tty: true | |
stdin_open: true | |
ports: | |
- "25565:25565" | |
environment: | |
INIT_MEMORY: 1G | |
MAX_MEMORY: 4G | |
EULA: "TRUE" | |
TYPE: "FABRIC" | |
VERSION: "1.20.4" | |
DIFFICULTY: "hard" | |
FORCE_GAMEMODE: true | |
MODE: "survival" | |
PVP: true | |
SERVER_NAME: "Maiden" | |
ENABLE_WHITELIST: true | |
WHITELIST_FILE: "/data/whitelist.json" | |
volumes: | |
# attach the relative directory 'data' to the container's /data path | |
- ./data:/data | |
backups: | |
image: itzg/mc-backup | |
environment: | |
BACKUP_INTERVAL: "8h" | |
RCON_HOST: mc | |
PRE_BACKUP_SCRIPT: | | |
echo "Before backup!" | |
echo "Also before backup from $$RCON_HOST to $$DEST_DIR" | |
POST_BACKUP_SCRIPT_FILE: /post-backup.sh | |
volumes: | |
# mount the same volume used by server, but read-only | |
- ./data:/data:ro | |
# use a host attached directory so that it in turn can be backed up | |
# to external/cloud storage | |
- ./backups:/backups | |
- ./post-backup.sh:/post-backup.sh:ro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Backup from $RCON_HOST to $DEST_DIR finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment