- 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
37 lines
663 B
Docker
37 lines
663 B
Docker
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
RUN mkdir -p data
|
|
|
|
RUN npm run build
|
|
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
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
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost/ || exit 1
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=80
|
|
|
|
CMD ["npx", "serve", "--listen", "80", "--single", "--cors", "dist"]
|