mc-cluster/velocity-image/Dockerfile

66 lines
2.2 KiB
Docker
Raw Normal View History

2024-12-06 06:38:37 -05:00
# Use the latest Ubuntu image as base
2024-12-06 05:52:08 -05:00
FROM ubuntu:latest
2024-12-06 06:38:37 -05:00
# Set environment variables
2024-12-06 05:52:08 -05:00
ENV PATH="/usr/bin:$PATH"
ENV NODE_MAJOR=18
2024-12-06 06:38:37 -05:00
# 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
2024-12-06 05:52:08 -05:00
2024-12-06 06:38:37 -05:00
# Download the Velocity server JAR
2024-12-06 05:52:08 -05:00
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
2024-12-06 06:38:37 -05:00
# Set up tools, configurations, and permissions
COPY pm2 /var/tools/pm2
RUN chmod +x -R /var/tools && npm install -g pm2
2024-12-06 05:52:08 -05:00
COPY velocity.toml /home/mc/minecraft
2024-12-06 06:38:37 -05:00
COPY forwarding.secret /home/mc/minecraft
2024-12-06 05:52:08 -05:00
2024-12-06 06:38:37 -05:00
# Add and prepare the startup script
2024-12-06 05:52:08 -05:00
COPY start.sh /start.sh
RUN chmod +x /start.sh
2024-12-06 06:38:37 -05:00
# Set the root password
2024-12-06 05:52:08 -05:00
RUN echo 'root:noshallpass' | chpasswd
2024-12-06 06:38:37 -05:00
# Set the default command to start the server
2024-12-06 05:52:08 -05:00
ENTRYPOINT ["/bin/bash", "/start.sh"]