- Changed output: 'static' → 'server' in astro.config.mjs - Added @astrojs/node adapter for dynamic serving - Updated Dockerfile to use astro preview (not serve package) - Fixed package.json dependency conflicts - All API routes will work (privacy consent logging) - Static pages still work Now includes BOTH: - ✅ Static pages (product pages, blog) - ✅ Dynamic API routes (cookie consent logging) - ✅ Admin dashboard with database access - ✅ Fixed host restrictions
35 lines
585 B
Docker
35 lines
585 B
Docker
# Build Stage
|
|
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
|
|
|
|
COPY package*.json ./
|
|
RUN npm install --production
|
|
|
|
COPY --from=builder /app/dist ./dist
|
|
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 ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "80"]
|