-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (43 loc) · 1.49 KB
/
Dockerfile
File metadata and controls
60 lines (43 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Multi-stage build for VitePress documentation
FROM oven/bun:1.2-alpine as build-stage
WORKDIR /app
# Install Chrome/Chromium for Puppeteer
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
# Tell Puppeteer to skip installing Chrome since we installed via package manager
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Copy package files
COPY package*.json ./
# Install dependencies
RUN bun install
# Copy source code
COPY . .
# Build the documentation (includes OG image generation)
RUN bun run docs:build
# Final stage - serve with nginx
FROM nginx:alpine
# Install additional tools for better performance
RUN apk add --no-cache tzdata
# Copy built files to nginx html directory
COPY --from=build-stage /app/.vitepress/dist /usr/share/nginx/html
# Debug: List markdown files to verify they're copied
RUN ls -la /usr/share/nginx/html/docs/*.md | head -5 || echo "No markdown files found"
# Remove default nginx config and copy our custom one
RUN rm -f /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Set timezone (optional)
ENV TZ=UTC
# Create directory for OG images (if not created during build)
RUN mkdir -p /usr/share/nginx/html/og
# Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
EXPOSE 80
# Use nginx with proper signal handling
CMD ["nginx", "-g", "daemon off;"]