From 1d83c90b2990995739336b5a8e841c2c7dacc8f4 Mon Sep 17 00:00:00 2001 From: Kunthawat Date: Wed, 11 Mar 2026 09:35:03 +0700 Subject: [PATCH] fix: Use serve for production hosting - Added 'serve' package for static file hosting - Updated Dockerfile to use 'serve' instead of astro preview - serve has no host restrictions - Fixes Easypanel access issue --- Dockerfile | 6 +++--- package.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08aa53def..18d80af18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ FROM node:20-alpine WORKDIR /app -# Install SQLite runtime +# Install SQLite runtime and serve RUN apk add --no-cache sqlite-libs COPY package*.json ./ @@ -40,5 +40,5 @@ ENV NODE_ENV=production ENV ASTRO_DB_REMOTE_URL=file:/app/data/consent.db ENV PORT=80 -# Start Astro preview server on port 80 -CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "80"] +# Use serve to host static files on port 80 +CMD ["npx", "serve", "dist", "-l", "80", "--config", "{\"directoryListing\": false, \"headers\": [{\"source\": \"**\", \"headers\": [{\"key\": \"Cache-Control\", \"value\": \"public, max-age=31536000, immutable\"}]}]}"] diff --git a/package.json b/package.json index f3cca2dad..6b904891c 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "astro": "^5.17.1", "astro-consent": "^1.0.17", "drizzle-orm": "^0.45.1", + "serve": "^14.2.4", "tailwindcss": "^4.2.1" } }