From 438441a03fee2e8125fc1a8076ec13f741c8d0ba Mon Sep 17 00:00:00 2001 From: Kunthawat Date: Tue, 10 Mar 2026 13:21:57 +0700 Subject: [PATCH] chore: Add Dockerfile for Astro project deployment - Multi-stage build for Astro subdirectory - SQLite runtime included - Database persistence configured - Health checks enabled Use this Dockerfile specifically for deploying the Astro project. --- dealplustech-astro/Dockerfile.astro | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 dealplustech-astro/Dockerfile.astro diff --git a/dealplustech-astro/Dockerfile.astro b/dealplustech-astro/Dockerfile.astro new file mode 100644 index 000000000..a550252fa --- /dev/null +++ b/dealplustech-astro/Dockerfile.astro @@ -0,0 +1,46 @@ +# Astro Dockerfile (Multi-stage build) +# Build Stage +FROM node:20-alpine AS builder + +WORKDIR /app + +# Copy Astro project only +COPY dealplustech-astro/package*.json ./ +RUN npm ci + +COPY dealplustech-astro/ ./ + +# 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 files +COPY dealplustech-astro/package*.json ./ +RUN npm ci --production + +# Copy built assets +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/public ./public +COPY --from=builder /app/astro.config.mjs ./ + +# Create data directory for database +RUN mkdir -p /app/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 + +# Start Astro preview server +CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4321"]