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.
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -6,13 +6,14 @@ WORKDIR /app
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
# 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
|
||||
@@ -23,13 +24,11 @@ WORKDIR /app
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install production dependencies only
|
||||
RUN npm ci --production
|
||||
# Install ALL dependencies (sharp is required for Astro image optimization)
|
||||
RUN npm ci
|
||||
|
||||
# Copy built assets from builder
|
||||
# Copy ONLY dist folder (contains build + public assets like favicon)
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/astro.config.mjs ./
|
||||
|
||||
# Expose port
|
||||
EXPOSE 4321
|
||||
|
||||
Reference in New Issue
Block a user