minecraft-clone / Dockerfile
TomatitoToho's picture
Upload Dockerfile with huggingface_hub
264a0af verified
Raw
History Blame Contribute Delete
822 Bytes
# Multi-stage build for Minecraft Clone on Hugging Face Spaces
FROM node:20-slim AS builder
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci --legacy-peer-deps 2>&1 | tail -5
# Copy source
COPY . .
# Build the Next.js app
RUN npm run build
# Copy static files and public directory to standalone output
RUN cp -r .next/static .next/standalone/.next/ && \
cp -r public .next/standalone/
# Production stage
FROM node:20-slim AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=7860
# Copy standalone build with public and static files
COPY --from=builder /app/.next/standalone ./
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:7860/ || exit 1
CMD ["node", "server.js"]