This commit is contained in:
2024-12-06 06:38:37 -05:00
parent c03877d469
commit b79c325086
9 changed files with 565 additions and 58 deletions

View File

@ -1,62 +1,65 @@
# Use the latest Ubuntu image as base
FROM ubuntu:latest
# Update OS and install deps
RUN apt update && apt clean && apt upgrade -y
RUN apt install -y curl apt-utils sudo curl python3 python-is-python3 git wget nano openssh-server apt-transport-https zip
# Get JDK Ready
RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /usr/share/keyrings/adoptium.asc
RUN echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
RUN cat /etc/apt/sources.list.d/adoptium.list
RUN sudo apt-get update
RUN apt update
# Install memory safe JDK
RUN DEBIAN_FRONTEND=noninteractive apt install temurin-21-jdk -y
# Download fabric server
# This needs to be changed to the version you wish to support.
RUN mkdir -vp /home/mc
RUN mkdir -vp /home/mc/minecraft
# Add a user
RUN useradd mc
# Let user use Bash
RUN usermod --shell /bin/bash mc
# Provide users ownership
RUN chown -R mc:mc /home/mc
# Set environment variables
ENV PATH="/usr/bin:$PATH"
RUN apt-get install -y ca-certificates curl gnupg
RUN sudo mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR=18
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install nodejs -y
# Update OS and install essential dependencies
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y \
curl \
apt-utils \
sudo \
python3 \
python-is-python3 \
git \
wget \
nano \
openssh-server \
apt-transport-https \
zip \
ca-certificates \
gnupg
# Add Adoptium GPG key and repository for JDK
RUN wget -qO- https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /usr/share/keyrings/adoptium.asc && \
echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list && \
apt-get update -y
# Install memory-safe JDK
RUN apt-get install -y temurin-21-jdk
# Create directories for the Minecraft server
RUN mkdir -p /home/mc/minecraft
# Add and configure a new user for the server
RUN useradd -m -s /bin/bash mc && chown -R mc:mc /home/mc
# Add NodeSource repository and install Node.js
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update -y && apt-get install -y nodejs
# Install Holesail globally
RUN npm install -g holesail
COPY pm2 /var/tools/pm2
# Download the Velocity server JAR
RUN wget -O /home/mc/minecraft/server.jar https://api.papermc.io/v2/projects/velocity/versions/3.4.0-SNAPSHOT/builds/454/downloads/velocity-3.4.0-SNAPSHOT-454.jar
RUN chmod +x -R /var/tools
# Install PM2
RUN npm install pm2 -g
# Set up tools, configurations, and permissions
COPY pm2 /var/tools/pm2
RUN chmod +x -R /var/tools && npm install -g pm2
COPY velocity.toml /home/mc/minecraft
COPY forwarding.secret /home/mc/minecraft
# Copy over start.sh to allow for backround run
# Add and prepare the startup script
COPY start.sh /start.sh
RUN chmod +x /start.sh
# Set root pass
# Set the root password
RUN echo 'root:noshallpass' | chpasswd
# Set the default command to start the server
ENTRYPOINT ["/bin/bash", "/start.sh"]