File size: 822 Bytes
a38ee85
d4e318a
 
a38ee85
d4e318a
 
a38ee85
264a0af
d4e318a
a38ee85
d4e318a
 
264a0af
a38ee85
d4e318a
264a0af
 
 
 
d4e318a
 
a38ee85
d4e318a
 
 
 
 
264a0af
d4e318a
 
a38ee85
d4e318a
 
a38ee85
264a0af
a38ee85
d4e318a
a38ee85
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
# 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"]