init commit
This commit is contained in:
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM ubuntu:jammy
|
||||
RUN apt-get update
|
||||
RUN apt-get upgrade -y
|
||||
RUN apt-get install jq -y
|
||||
RUN apt-get install webp -y
|
||||
RUN apt-get install openjdk-17-jre -y
|
||||
RUN apt-get install curl -y
|
||||
RUN apt-get install wget -y
|
||||
RUN mkdir -p /opt/ftbmc
|
||||
RUN mkdir -p /tmp/modpackch
|
||||
WORKDIR /tmp/modpackch
|
||||
COPY downloadpack.sh .
|
||||
COPY cleanup.sh .
|
||||
COPY setup.sh .
|
||||
RUN chmod +x *sh
|
||||
|
||||
ENV MAXMEMORY="20g"
|
||||
ENV MINMEMORY="10g"
|
||||
|
||||
ENTRYPOINT [ "bash", "./setup.sh" ]
|
||||
22
cleanup.sh
Normal file
22
cleanup.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
set -e # Error out immediately on failed line
|
||||
set +x # Don't print commands as they are run
|
||||
|
||||
echo "Cleaning up old installation (if any, exluding world and property files)..."
|
||||
# The aim is to delete anything that doesn't need to be persistent between upgrades
|
||||
echo "Deleting mods..." # Mods may change between versions
|
||||
rm -rf ./mods
|
||||
echo "Deleting forge jars..." # The version of Forge may change
|
||||
rm -f forge-*
|
||||
echo "Deleting Minecraft jars..." # The version of Minecraft may change
|
||||
rm -f minecraft_server*
|
||||
echo "Deleting libraries..." # Unsure if libraries might change
|
||||
rm -rf ./libraries
|
||||
echo "Deleting kubejs..." # Not sure what this folder is, but I don't think anything persistent is stored in it
|
||||
rm -rf ./kubejs
|
||||
echo "Deleting packmenu..." # Not sure what this folder is, but I don't think anything persistent is stored in it
|
||||
rm -rf ./packmenu
|
||||
echo "Deleting old installers..." # These shouldn't conflict, but I'm deleting them in-case they ever have a hotfix release with the same name
|
||||
rm -f serverinstall*
|
||||
echo "Cleanup Complete "
|
||||
echo "=========================="
|
||||
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
ftbmc:
|
||||
container_name: ftbmc118
|
||||
image: ftbdw20118
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./ftbmc:/opt/ftbmc
|
||||
ports:
|
||||
- "25566:25565"
|
||||
environment:
|
||||
MODPACKID: '95'
|
||||
VERSION: 'LATEST'
|
||||
networks:
|
||||
- minecraft2
|
||||
|
||||
networks:
|
||||
minecraft2:
|
||||
21
downloadpack.sh
Normal file
21
downloadpack.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e # Error out immediately on failed line
|
||||
set +x # Don't print commands as they are run
|
||||
|
||||
if [[ -z "${MODPACKID}" ]] || [[ -z "${VERSION}" ]];
|
||||
then
|
||||
echo "Invalid MODPACKID or VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If we're using the latest version (it's not manually specified)
|
||||
if [ "$VERSION" == "LATEST" ]
|
||||
# Lookup the latest version available from the API and save it to the version variable
|
||||
then VERSION=$(curl https://api.modpacks.ch/public/modpack/$MODPACKID/ | jq '.versions[-1].id'); fi;
|
||||
|
||||
echo "Downloading installer..."
|
||||
wget https://api.modpacks.ch/public/modpack/$MODPACKID/$VERSION/server/linux --content-disposition
|
||||
#echo "Renaming..."
|
||||
#mv ./serverinstall_"$MODPACKID"_"$VERSION" ./serverinstall
|
||||
echo "Making it executable..."
|
||||
chmod +x ./serverinstall_"$MODPACKID"_"$VERSION"
|
||||
28
setup.sh
Normal file
28
setup.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set +x
|
||||
|
||||
if [[ -z ${MODPACKID} ]];then MODPACKID='95';fi
|
||||
if [[ -z ${VERSION} ]];then VERSION='LATEST';fi
|
||||
cp cleanup.sh /opt/ftbmc
|
||||
cd /opt/ftbmc
|
||||
|
||||
if [ -f "/opt/ftbmc/.updatelock" ]; then
|
||||
echo "Operating in manual mode!"
|
||||
echo "Updating disabled. Not overwriting files."
|
||||
else
|
||||
echo "Cleaning old files.."
|
||||
/opt/ftbmc/cleanup.sh
|
||||
echo "Downloading new files..."
|
||||
cd /tmp/modpackch
|
||||
/tmp/modpackch/downloadpack.sh
|
||||
echo "Installing new files..."
|
||||
/tmp/modpackch/serverinstall* --path /opt/ftbmc --latest --auto
|
||||
cd /opt/ftbmc
|
||||
touch /opt/ftbmc/.updatelock
|
||||
fi
|
||||
|
||||
# echo "Creating Minecraft EULA file"
|
||||
echo "Now starting server..."
|
||||
echo "eula=true" > eula.txt
|
||||
./run.sh
|
||||
Reference in New Issue
Block a user