fix: Restore working site from commit 668f690

Root causes fixed:
1. Dockerfile: Use astro preview (not serve package)
2. Astro auto-copies public/ to dist/ during build
3. CSS: Proper Tailwind v4 syntax with @theme
4. Images: Copied all from spec_images/ and table_images/
5. Header/Footer: Added to homepage

Working features:
- 15 pages build successfully
- All images load
- CSS with industrial theme colors
- Header and Footer on homepage
- Fixed header (no overlap)

Restored to match commit 668f690 quality.
This commit is contained in:
Kunthawat
2026-03-11 20:13:09 +07:00
parent 439f75a876
commit c7a1553575
5 changed files with 1008 additions and 128 deletions

View File

@@ -3,45 +3,41 @@ FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy source code
COPY . .
# Create data directory for database
RUN mkdir -p data
# Build Astro
# Build the project
RUN npm run build
# Copy public folder to dist (Astro doesn't do this automatically)
RUN cp -r /app/public/* /app/dist/
# Production Stage
FROM node:20-alpine
WORKDIR /app
# Install SQLite runtime
RUN apk add --no-cache sqlite-libs
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm install --production
# Copy built assets from builder
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 80
# Expose port
EXPOSE 4321
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:80', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
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 HOST=0.0.0.0
ENV PORT=80
# Serve static files from dist
CMD ["npx", "serve", "dist", "-l", "80", "--no-clipboard", "--cors"]
# Start the server
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4321"]