smp-manager / Dockerfile
techedstudios
Add Java 25+ support and version switcher in UI
71a9b07
Raw History Blame Contribute Delete
1.43 kB
FROM node:20-bookworm
# Install required tools
RUN apt-get update && apt-get install -y wget git curl && \
rm -rf /var/lib/apt/lists/*
# Install Temurin OpenJDK 21 JRE
RUN mkdir -p /opt/java21 && \
wget -qO- https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jre_x64_linux_hotspot_21.0.2_13.tar.gz | tar -xzC /opt/java21 --strip-components=1
# Install Temurin OpenJDK 26 JRE (For Java 25+ plugins)
RUN mkdir -p /opt/java26 && \
wget -qO- https://github.com/adoptium/temurin26-binaries/releases/download/jdk-26.0.1%2B8/OpenJDK26U-jre_x64_linux_hotspot_26.0.1_8.tar.gz | tar -xzC /opt/java26 --strip-components=1
ENV JAVA_HOME=/opt/java21
ENV PATH="${JAVA_HOME}/bin:${PATH}"
# Verify default java installation
RUN java -version
# Set up working directory
WORKDIR /app
# Set ownership of app directory to the node user
RUN chown -R node:node /app
# Switch to standard non-root user (ID 1000) for security on Hugging Face
USER node
# Copy package files first for caching
COPY --chown=node:node package*.json ./
# Install dependencies
RUN npm install
# Copy application code
COPY --chown=node:node . .
# Build the React frontend
RUN npm run build
# Expose Hugging Face Space default port
EXPOSE 3001
# Environment settings
ENV PORT=3001
ENV NODE_ENV=production
# Start Express server which serves frontend and manages Minecraft process
CMD ["node", "server.js"]