feat: Migrate Astro to root - Replace Next.js completely
- 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
This commit is contained in:
30
Dockerfile
30
Dockerfile
@@ -3,16 +3,15 @@ FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build Next.js project
|
||||
# Create data directory for database
|
||||
RUN mkdir -p data
|
||||
|
||||
# Build Astro
|
||||
RUN npm run build
|
||||
|
||||
# Production Stage
|
||||
@@ -20,23 +19,26 @@ FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
# Install SQLite runtime
|
||||
RUN apk add --no-cache sqlite-libs
|
||||
|
||||
# Install production dependencies only
|
||||
COPY package*.json ./
|
||||
RUN npm ci --production
|
||||
|
||||
# Copy built Next.js app
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
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 port
|
||||
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)})"
|
||||
|
||||
# Start Next.js server
|
||||
CMD ["node", "server.js"]
|
||||
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"]
|
||||
|
||||
Reference in New Issue
Block a user