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
This commit is contained in:
Kunthawat
2026-03-11 09:35:03 +07:00
parent c86502b0b1
commit 1d83c90b29
2 changed files with 4 additions and 3 deletions

View File

@@ -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\"}]}]}"]

View File

@@ -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"
}
}