From 2465feec7eab9d3f9cd73fe28b14efb8972ce498 Mon Sep 17 00:00:00 2001 From: Kunthawat Greethong Date: Mon, 9 Mar 2026 22:04:55 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20Fix:=20Bind=20server=20to=200.0.?= =?UTF-8?q?0.0=20for=20Docker=20accessibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94f86dff8..2f5c8127a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,31 @@ -# Production Docker for Astro Static Site +# Build Stage FROM node:20-alpine AS builder + WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build +# Production Stage FROM node:20-alpine + WORKDIR /app + +# Copy built assets COPY --from=builder /app/dist ./dist +COPY --from=builder /app/package.json ./ + +# Install serve globally RUN npm install -g serve + +# Expose port EXPOSE 3000 -ENV NODE_ENV=production PORT=3000 HOST=0.0.0.0 -CMD ["serve", "dist", "-l", "3000", "--single"] + +# Environment +ENV NODE_ENV=production +ENV PORT=3000 +ENV HOST=0.0.0.0 + +# Start server - MUST bind to 0.0.0.0 for Docker +CMD ["serve", "dist", "-l", "3000", "--config", "{\"public\":\"dist\",\"directoryListing\":false}"]