Files
landing/Dockerfile

42 lines
1.0 KiB
Docker

# Static site container for mifi Ventures
# Build stage: run critical CSS inlining; final stage: serve dist/ via nginx
# Stage 1: Build (critical CSS inlining + copy assets → dist/)
FROM node:20-alpine AS builder
WORKDIR /app
# Enable pnpm via Corepack
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile || pnpm install
COPY build.mjs ./
COPY site/ ./site/
RUN pnpm run build
# Stage 2: Serve
FROM nginx:alpine
# Copy custom nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Copy built site (dist/) from builder
COPY --from=builder /app/dist/ /usr/share/nginx/html/
# Set proper permissions
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chmod -R 755 /usr/share/nginx/html
# Expose port 80
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1
# Run nginx in foreground
CMD ["nginx", "-g", "daemon off;"]