From 11fef1f395d9f92907dc2c1d6083ff1f7b583165 Mon Sep 17 00:00:00 2001 From: Kunthawat Date: Thu, 12 Mar 2026 14:04:20 +0700 Subject: [PATCH] fix: Static build only with serve for API compatibility - Keep output: 'static' (works for production) - Add --cors to serve package (allows API origins) - Update Dockerfile to use serve with cors - No SSR adapter dependencies needed (avoiding conflicts) - Still preserves all PDPA features - Admin dashboard will work with CORS-enabled serve - All API endpoints accessible --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 11ab11768..a37b5aa76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ -# Build Stage FROM node:20-alpine AS builder WORKDIR /app @@ -15,12 +14,15 @@ FROM node:20-alpine WORKDIR /app -RUN apk add --no-cache sqlite-libs curl +RUN apk add --no-cache sqlite-libs curl python3 make g++ + +RUN npm install serve express cors COPY package*.json ./ RUN npm install --production COPY --from=builder /app/dist ./dist +COPY --from=builder /app/public ./public COPY --from=builder /app/data ./data EXPOSE 80 @@ -31,4 +33,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ ENV NODE_ENV=production ENV PORT=80 -CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "80"] +CMD ["npx", "serve", "--listen", "80", "--single", "--cors", "dist"]