- Removed Next.js project (src, app, components, etc.) - Moved Astro from dealplustech-astro/ to root - Updated Dockerfile for Astro root deployment - All PDPA compliance features preserved: * Cookie consent banner * Consent logging API with SQLite * Admin dashboard (/admin/consent-logs) * Privacy Policy (Thai, PDPA-compliant) * Terms & Conditions (Thai) - 15 pages: homepage, 6 products, 3 blog posts, legal pages, admin - Build: 660ms, all pages generated successfully
45 lines
924 B
Docker
45 lines
924 B
Docker
# Build Stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
|
|
# Create data directory for database
|
|
RUN mkdir -p data
|
|
|
|
# Build Astro
|
|
RUN npm run build
|
|
|
|
# Production Stage
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install SQLite runtime
|
|
RUN apk add --no-cache sqlite-libs
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci --production
|
|
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/astro.config.mjs ./
|
|
COPY --from=builder /app/data ./data
|
|
|
|
EXPOSE 4321
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD node -e "require('http').get('http://localhost:4321', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
|
|
|
ENV NODE_ENV=production
|
|
ENV ASTRO_DB_REMOTE_URL=file:/app/data/consent.db
|
|
ENV PORT=4321
|
|
|
|
# Start Astro preview server
|
|
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4321"]
|