| # Use Ubuntu-based image instead of Alpine for better compatibility | |
| FROM node:18-bookworm AS dependencies | |
| WORKDIR /app | |
| COPY package*.json ./ | |
| RUN npm install --legacy-peer-deps | |
| FROM dependencies AS builder | |
| WORKDIR /app | |
| COPY . . | |
| # Make sure we have all necessary config files | |
| COPY vite.config.js svelte.config.js ./ | |
| # Ensure PRIVACY.md is available at the right location | |
| RUN if [ -f PRIVACY.md ]; then echo "PRIVACY.md found"; else echo "PRIVACY.md missing"; fi | |
| RUN npm run build | |
| FROM node:18-bookworm-slim AS deploy | |
| WORKDIR /app | |
| COPY --from=dependencies /app/node_modules ./node_modules | |
| COPY --from=builder /app/build ./build | |
| COPY --from=builder /app/static ./static | |
| # Also copy PRIVACY.md for runtime if needed | |
| COPY --from=builder /app/PRIVACY.md ./PRIVACY.md | |
| COPY . . | |
| # Set environment variables | |
| ENV NODE_ENV=production | |
| ENV PORT=3000 | |
| # Expose port | |
| EXPOSE 3000 | |
| # Start command | |
| CMD ["npm", "run", "preview", "--", "--port", "3000", "--host", "0.0.0.0"] | |