Use serve instead of astro preview (fix Vite allowedHosts bug)

This commit is contained in:
Kunthawat Greethong
2026-03-13 09:31:45 +07:00
parent 5eaaf6f632
commit 176754c1c4

View File

@@ -4,12 +4,11 @@ COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev
COPY --from=builder /app/dist ./dist
RUN apk add --no-cache sqlite-libs
RUN npm install -g serve
EXPOSE 80
ENV NODE_ENV=production HOST=0.0.0.0 PORT=80
CMD ["npx", "astro", "preview", "--host", "0.0.0.0", "--port", "80"]
ENV NODE_ENV=production
CMD ["serve", "-s", "dist", "-l", "80", "--listen-addr", "0.0.0.0"]