sindh-gambit / Dockerfile
krishbaresha's picture
Update Dockerfile
bc09953 verified
Raw
History Blame Contribute Delete
1.09 kB
# Stage 1: Build Stage
FROM node:20-alpine AS builder
WORKDIR /app
# Step 1: Dependencies install karein
COPY package.json package-lock.json ./
# Agar package-lock nahi hai toh sirf package.json copy karke 'npm install' karein
RUN npm install
# Step 2: Saara code copy karein
COPY . .
# Step 3: Production build banayein
# Humne next.config.ts mein errors ignore karne ka set kar diya hai
RUN npm run build
# Stage 2: Runner Stage (Final Image)
FROM node:20-alpine AS runner
WORKDIR /app
# Production environment set karein
ENV NODE_ENV production
# --- SECRETS & PORT ---
# Hugging Face secrets yahan map honge
ENV GROQ_API_KEY=$GROQ_API_KEY
# Hugging Face default port 7860 use karta hai
ENV PORT 7860
EXPOSE 7860
# Step 4: Builder stage se sirf zaruri files copy karein (Optimized size)
COPY --from=builder /app/next.config.ts ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
# Step 5: App start karein
CMD ["npm", "start", "--", "-p", "7860"]