From f972f688752b452fb08fbdf2ef7d05c2d0c3c2d0 Mon Sep 17 00:00:00 2001 From: Kunthawat Greethong Date: Tue, 3 Mar 2026 10:10:47 +0700 Subject: [PATCH] fix: Simplify Dockerfile - let Astro handle public folder - Remove manual public folder copy - Astro build automatically includes public/ in dist/ - This ensures favicons and other static assets are served Fixes favicon 404 error. --- dealplustech-astro/Dockerfile | 38 +++++++++-------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/dealplustech-astro/Dockerfile b/dealplustech-astro/Dockerfile index 2e92df639..f4ef0a450 100644 --- a/dealplustech-astro/Dockerfile +++ b/dealplustech-astro/Dockerfile @@ -1,21 +1,4 @@ -# Build Stage -FROM node:20-alpine AS builder - -WORKDIR /app - -# Copy package files -COPY package*.json ./ - -# Install dependencies -RUN npm ci - -# Copy source code -COPY . . - -# Build the project -RUN npm run build - -# Production Stage +# Astro Production Dockerfile FROM node:20-alpine WORKDIR /app @@ -23,20 +6,17 @@ WORKDIR /app # Copy package files COPY package*.json ./ -# Install production dependencies only -RUN npm ci --production +# Install dependencies +RUN npm ci --omit=dev -# 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 source code +COPY . . + +# Build Astro project (includes public folder in dist) +RUN npm run build # 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 the server +# Start Astro preview server CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4321"]