Files
dealplustech/Dockerfile
Kunthawat Greethong 6b974073cb fix: Fix PostCSS config and Dockerfile
1. Rename postcss.config.js to postcss.config.cjs
   - Fixes CommonJS syntax in ES module project
   - Allows build to complete successfully

2. Remove --production flag from Dockerfile
   - Install ALL dependencies including sharp
   - Sharp required for Astro image optimization
   - Fixes sharp missing error

Both fixes enable successful Docker build and favicon to work.
2026-03-03 14:51:29 +07:00

42 lines
915 B
Docker

# Build Stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install ALL dependencies (including sharp for image optimization)
RUN npm ci
# Copy source code
COPY . .
# Build the project
# Astro automatically copies public/ to dist/
RUN npm run build
# Production Stage
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install ALL dependencies (sharp is required for Astro image optimization)
RUN npm ci
# Copy ONLY dist folder (contains build + public assets like favicon)
COPY --from=builder /app/dist ./dist
# 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
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4321"]