1. Header overlap fixed: - Added pt-32 (padding-top: 8rem) to main - Compensates for fixed header height 2. Images not showing ROOT CAUSE FIXED: - Public folder NOT auto-copied to dist by Astro - Added: RUN cp -r /app/public/* /app/dist/ - Now images will be in dist/images/ after build - Serve can find them at /images/... This is the actual fix - Astro doesn't copy public to dist!
48 lines
991 B
Docker
48 lines
991 B
Docker
# Build Stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
|
|
# Create data directory for database
|
|
RUN mkdir -p data
|
|
|
|
# Build Astro
|
|
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*.json ./
|
|
RUN npm install --production
|
|
|
|
# Copy built assets from builder
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/data ./data
|
|
|
|
EXPOSE 80
|
|
|
|
# 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)})"
|
|
|
|
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"]
|