FROM openjdk:22
RUN mkdir /app
WORKDIR /app
RUN curl -o installer.jar -OJ https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar
RUN java -jar installer.jar server -mcversion 1.20.1 -downloadMinecraft
RUN rm installer.jar \
    && mv server.jar vanilla.jar \
    && mv fabric-server-launch.jar server.jar \
    && echo "serverJar=vanilla.jar" > fabric-server-launcher.properties \
    && echo "eula=true" > eula.txt
COPY server.properties server.properties
COPY package/overrides/mods /app/mods
COPY package/overrides/config /app/config
RUN rm /app/mods/*AllMusic_Client*.jar
RUN rm /app/mods/chattools*.jar
RUN rm /app/mods/CustomSkinLoader*.jar
RUN rm /app/mods/iris*.jar
RUN rm /app/mods/modmenu*.jar
RUN rm /app/mods/MouseTweaks*.jar
RUN rm /app/mods/*.jar.disabled
RUN rm /app/mods/indium*.jar
RUN rm /app/mods/I18nUpdateMod*.jar
RUN rm /app/mods/sodium*.jar
VOLUME [ "/app/world" ]
ENTRYPOINT [ "java", "-Xms4G", "-Xmx32G", "-jar", "server.jar" ]