Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Refactor IndexPage to improve analytics display and user experience

Bill Yang9b54c5d03eb0
diff --git a/docs/Caddyfile b/docs/Caddyfile
new file mode 100644
index 000000000..79c97af17
--- /dev/null
+++ b/docs/Caddyfile
@@ -0,0 +1,18 @@
+# Caddyfile for docs
+{$DOMAIN_NAME} {
+ # Enable compression
+ encode zstd gzip
+
+ # Proxy all requests to the docs service
+ handle {
+ reverse_proxy docs_app:3000
+ }
+
+ # Security headers
+ header {
+ Strict-Transport-Security max-age=31536000;
+ X-Content-Type-Options nosniff
+ X-Frame-Options DENY
+ Referrer-Policy strict-origin-when-cross-origin
+ }
+}
\ No newline at end of file
diff --git a/docs/Dockerfile b/docs/Dockerfile
new file mode 100644
index 000000000..baffcb8ca
--- /dev/null
+++ b/docs/Dockerfile
@@ -0,0 +1,51 @@
+FROM node:20-alpine AS base
+
+# Install dependencies only when needed
+FROM base AS deps
+RUN apk add --no-cache libc6-compat
+WORKDIR /app
+
+# Install dependencies based on the preferred package manager
+COPY package.json package-lock.json* ./
+RUN npm ci --legacy-peer-deps
+
+# Rebuild the source code only when needed
+FROM base AS builder
+WORKDIR /app
+COPY --from=deps /app/node_modules ./node_modules
+COPY . .
+
+# Next.js collects completely anonymous telemetry data about general usage.
+ENV NEXT_TELEMETRY_DISABLED 1
+
+RUN npm run build
+
+# Production image, copy all the files and run next
+FROM base AS runner
+WORKDIR /app
+
+ENV NODE_ENV production
+ENV NEXT_TELEMETRY_DISABLED 1
+
+RUN addgroup --system --gid 1001 nodejs
+RUN adduser --system --uid 1001 nextjs
+
+COPY --from=builder /app/public ./public
+
+# Set the correct permission for prerender cache
+RUN mkdir .next
+RUN chown nextjs:nodejs .next
+
+# Automatically leverage output traces to reduce image size
+# https://nextjs.org/docs/advanced-features/output-file-tracing
+COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
+COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
+
+USER nextjs
+
+EXPOSE 3000
+
+ENV PORT 3000
+ENV HOSTNAME "0.0.0.0"
+
+CMD ["node", "server.js"]
\ No newline at end of file
diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml
new file mode 100644
index 000000000..e99c9a763
--- /dev/null
+++ b/docs/docker-compose.yml
@@ -0,0 +1,29 @@
+services:
+ caddy:
+ image: caddy:latest
+ container_name: docs_caddy
+ restart: unless-stopped
+ ports:
+ - "8080:80" # Using different port to avoid conflict with main app
+ - "8443:443"
+ - "8443:443/udp" # Needed for HTTP/3
+ volumes:
+ - ./Caddyfile:/etc/caddy/Caddyfile # Mount Caddy config file
+ - docs_caddy_data:/data # Mount persistent data volume for certs etc.
+ - docs_caddy_config:/config # Mount persistent config volume
+ environment:
+ # Pass domain name for use in Caddyfile (will need to be set when running)
+ - DOMAIN_NAME=rybbit.io
+ depends_on:
+ - docs
+
+ docs:
+ container_name: docs_app
+ build:
+ context: .
+ dockerfile: Dockerfile
+ restart: unless-stopped
+
+volumes:
+ docs_caddy_data: # Persistent volume for Caddy's certificates and state
+ docs_caddy_config: # Persistent volume for Caddy's configuration cache
\ No newline at end of file