Spaces:
Sleeping
Sleeping
File size: 1,425 Bytes
ae9dc79 529cde8 ae9dc79 71a9b07 ae9dc79 71a9b07 ae9dc79 71a9b07 ae9dc79 e546544 ae9dc79 e546544 ae9dc79 | 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 | 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"]
|