-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.docs
More file actions
65 lines (49 loc) · 2.15 KB
/
Dockerfile.docs
File metadata and controls
65 lines (49 loc) · 2.15 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
61
62
63
64
65
# Dockerfile for Fluxbase Documentation Site
# This builds a standalone container for the Starlight (Astro) documentation
#
# This Dockerfile generates TypeDoc API documentation from the SDK source files
# and builds the complete documentation site.
FROM oven/bun:1.3.10-debian AS builder
WORKDIR /app
# Copy workspace configuration
COPY package.json ./
COPY bun.lock ./
# Copy all package.json files for workspace resolution
COPY docs/package.json ./docs/
COPY sdk/package.json ./sdk/
COPY sdk-react/package.json ./sdk-react/
COPY admin/package.json ./admin/
# Copy SDK source files (needed for TypeDoc generation)
COPY sdk/ ./sdk/
COPY sdk-react/ ./sdk-react/
# Copy docs source
COPY docs/ ./docs/
# Install dependencies (this sets up workspace symlinks correctly)
RUN bun install --frozen-lockfile
# Build the static site (Astro/Starlight with starlight-typedoc)
# Set NODE_OPTIONS to provide a localstorage file path for Node.js 25
ENV NODE_OPTIONS="--localstorage-file=/tmp/localstorage.db"
RUN cd docs && bun run build
# Production image - serve with nginx
FROM nginx:alpine AS runner
# Create necessary directories with correct permissions for non-root user
RUN mkdir -p /tmp/client_temp /tmp/proxy_temp /tmp/fastcgi_temp /tmp/uwsgi_temp /tmp/scgi_temp \
/var/cache/nginx /usr/share/nginx/html && \
chown -R nginx:nginx /tmp/client_temp /tmp/proxy_temp /tmp/fastcgi_temp /tmp/uwsgi_temp /tmp/scgi_temp \
/var/cache/nginx /usr/share/nginx/html && \
chmod -R 755 /tmp/client_temp /tmp/proxy_temp /tmp/fastcgi_temp /tmp/uwsgi_temp /tmp/scgi_temp
# Copy built site to nginx (Astro outputs to dist/)
COPY --from=builder /app/docs/dist /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.docs.conf /etc/nginx/nginx.conf
# Expose port 8080 (non-privileged port)
EXPOSE 8080
# Switch to non-root user
USER nginx
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
# Start nginx directly, bypassing the default entrypoint
ENTRYPOINT []
CMD ["nginx", "-g", "daemon off;"]