File size: 2,566 Bytes
a659efe
 
 
 
 
 
 
 
 
 
35ed903
 
b4b1bad
81993b6
 
1aa7685
7194e62
a659efe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81993b6
6eec2fa
c7b17d1
5e62bc4
 
c7b17d1
b4b1bad
c70722b
6eec2fa
a659efe
 
 
 
 
 
81993b6
 
13a219b
92c04ea
 
efd0b6d
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
# Use the latest Python image as the base
FROM python:latest

# Install required system packages and Oracle JDK 21
USER root
RUN apt-get update && apt-get install -y \
    curl \
    jq \
    wget \
    bash \
    nano \
    git \
    imagemagick \
    zip \
    unzip \
    git-lfs \
    && git lfs install \
    && wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb \
    && dpkg -i jdk-21_linux-x64_bin.deb \
    && rm jdk-21_linux-x64_bin.deb \
    && rm -rf /var/lib/apt/lists/*

# Upgrade pip to the latest version
RUN pip install --no-cache-dir --upgrade pip

# Create a non-root user and switch to it
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set working directory for Minecraft
WORKDIR /minecraft

# Copy required files into the container (ensure these exist in your build context)
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/eula.txt
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/server.py
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/server.properties
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/start.sh
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/plugins.sh
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/server-icon.png
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/playit.sh
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/sshx
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/configs.zip
RUN wget https://raw.githubusercontent.com/KnoxTheDev/main-server/refs/heads/main/backup.sh
# Check if worlds.zip exists before downloading
RUN wget --spider https://huggingface.co/datasets/knoxius/primary/resolve/main/worlds.zip && \
    wget https://huggingface.co/datasets/knoxius/primary/resolve/main/worlds.zip && unzip worlds.zip && rm worlds.zip || \
    echo "worlds.zip not found, skipping download."
RUN convert server-icon.png -resize 64x64 server-icon.png
RUN sed -i 's/\r$//' playit.sh
RUN chmod +x plugins.sh start.sh playit.sh backup.sh sshx

# Install Python dependencies (for your downloader scripts)
RUN pip install --no-cache-dir requests

# Expose the necessary ports: 7860 for the dummy HTTP server
EXPOSE 7860

# Setup plugins' configs
RUN unzip configs.zip && rm configs.zip

# Entrypoint Commands
CMD python -m http.server 7860 > /dev/null 2>&1 & ./sshx