diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 5f4c975..cdfc700 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -1,4 +1,4 @@ -name: build docker image and push to dockerhub +name: Build and Push Docker Images (Default + Simple Mode) on: push: @@ -6,6 +6,7 @@ on: - 'main' tags: - 'v*' + workflow_dispatch: jobs: docker-build-and-push: @@ -13,6 +14,15 @@ jobs: permissions: contents: write packages: write + strategy: + matrix: + mode: + - name: default + simple_mode: false + suffix: "" + - name: simple + simple_mode: true + suffix: "-simple" steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -35,12 +45,16 @@ jobs: echo "version_without_v=latest" >> $GITHUB_OUTPUT fi - - name: Build and push + - name: Build and push ${{ matrix.mode.name }} image uses: docker/build-push-action@v6 with: push: true + build-args: | + SIMPLE_MODE=${{ matrix.mode.simple_mode }} tags: | - bentopdf/bentopdf:latest - bentopdf/bentopdf:${{ steps.version.outputs.version_without_v }} - bentopdf/bentopdf:${{ steps.version.outputs.version }} + bentopdf/bentopdf${{ matrix.mode.suffix }}:latest + bentopdf/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version_without_v }} + bentopdf/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }} platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/SIMPLE_MODE.md b/SIMPLE_MODE.md index b41d41e..5a9873e 100644 --- a/SIMPLE_MODE.md +++ b/SIMPLE_MODE.md @@ -19,40 +19,88 @@ When enabled, Simple Mode will: ## How to Enable Simple Mode -### Using Docker Compose +### Method 1: Using Pre-built Simple Mode Image (Recommended) -1. Create a `.env` file in your project root: +Use the pre-built Simple Mode image directly: ```bash -SIMPLE_MODE=true +docker run -p 3000:80 bentopdf/bentopdf-simple:latest ``` -2. Run with docker-compose: +Or with Docker Compose: + +```yaml +services: + bentopdf: + image: bentopdf/bentopdf-simple:latest + container_name: bentopdf + restart: unless-stopped + ports: + - '3000:80' +``` + +### Method 2: Using Docker Compose with Build + +Build the image locally with Simple Mode enabled: ```bash -docker-compose up -d +docker compose -f docker-compose.dev.yml build --build-arg SIMPLE_MODE=true +docker compose -f docker-compose.dev.yml up -d ``` -### Using Docker Build +### Method 3: Using Docker Build -Build the image with the SIMPLE_MODE environment variable: +Build the image with the SIMPLE_MODE build argument: ```bash docker build --build-arg SIMPLE_MODE=true -t bentopdf-simple . +docker run -p 3000:80 bentopdf-simple ``` -### Using Environment Variables +### Method 4: Using npm Script (Easiest for Local Development) + +Use the built-in npm script that handles everything: + +```bash +npm run serve:simple +``` + +This command automatically: +- Sets `SIMPLE_MODE=true` +- Builds the project with Simple Mode enabled +- Serves the built files on `http://localhost:3000` + +### Method 5: Using Environment Variables Set the environment variable before building: ```bash export SIMPLE_MODE=true npm run build +npx serve dist -p 3000 ``` ## ๐งช Testing Simple Mode Locally -After building with Simple Mode enabled, you need to serve the built files locally. +### Method 1: Using npm Script (Easiest for Development) + +```bash +npm run serve:simple +``` + +This automatically builds and serves Simple Mode on `http://localhost:3000`. + +### Method 2: Using Pre-built Image (Easiest for Production) + +```bash +# Pull and run the Simple Mode image +docker pull bentopdf/bentopdf-simple:latest +docker run -p 3000:80 bentopdf/bentopdf-simple:latest +``` + +Open `http://localhost:3000` in your browser. + +### Method 3: Build and Test Locally ```bash # Build with simple mode @@ -62,7 +110,20 @@ SIMPLE_MODE=true npm run build npx serve dist -p 3000 ``` -Then open `http://localhost:3000` in your browser. +Open `http://localhost:3000` in your browser. + +### Method 4: Compare Both Modes + +```bash +# Test Normal Mode +docker run -p 3000:80 bentopdf/bentopdf:latest + +# Test Simple Mode +docker run -p 3001:80 bentopdf/bentopdf-simple:latest +``` + +- Normal Mode: `http://localhost:3000` +- Simple Mode: `http://localhost:3001` ## ๐ What to Look For @@ -76,16 +137,37 @@ When Simple Mode is working correctly, you should see: - โ No hero section with "The PDF Toolkit built for privacy" - โ No features, FAQ, testimonials, or footer sections -## Example Docker Compose Configuration +## ๐ฆ Available Docker Images +### Normal Mode (Full Branding) +- `bentopdf/bentopdf:latest` +- `bentopdf/bentopdf:v1.0.0` (versioned) + +### Simple Mode (Clean Interface) +- `bentopdf/bentopdf-simple:latest` +- `bentopdf/bentopdf-simple:v1.0.0` (versioned) + +## ๐ Production Deployment Examples + +### Internal Company Tool ```yaml services: bentopdf: - image: bentopdf/bentopdf:latest + image: bentopdf/bentopdf-simple:latest container_name: bentopdf restart: unless-stopped ports: - - '3000:80' + - "80:80" environment: - - SIMPLE_MODE=true + - PUID=1000 + - PGID=1000 ``` + + + +## โ ๏ธ Important Notes + +- **Pre-built images**: Use `bentopdf/bentopdf-simple:latest` for Simple Mode +- **Environment variables**: `SIMPLE_MODE=true` only works during build, not runtime +- **Build-time optimization**: Simple Mode uses dead code elimination for smaller bundles +- **Same functionality**: All PDF tools work identically in both modes diff --git a/docker-compose.yml b/docker-compose.yml index 2c9d236..3906b17 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ services: bentopdf: - image: bentopdf/bentopdf:latest + # simple mode - bentopdf/bentopdf-simple:latest + # default mode - bentopdf/bentopdf:latest + image: bentopdf/bentopdf-simple:latest container_name: bentopdf restart: unless-stopped ports: - - '3000:80' - environment: - - SIMPLE_MODE=${SIMPLE_MODE:-false} + - '3000:80' \ No newline at end of file diff --git a/package.json b/package.json index 762b0d0..48782ad 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "format": "prettier --write .", "release": "node scripts/release.js patch", "release:minor": "node scripts/release.js minor", - "release:major": "node scripts/release.js major" + "release:major": "node scripts/release.js major", + "serve:simple": "SIMPLE_MODE=true npm run build && npx serve dist -p 3000" }, "devDependencies": { "@testing-library/dom": "^10.4.1", diff --git a/src/js/main.ts b/src/js/main.ts index 1eacb7f..dc529e8 100644 --- a/src/js/main.ts +++ b/src/js/main.ts @@ -5,84 +5,117 @@ import { createIcons, icons } from 'lucide'; import * as pdfjsLib from 'pdfjs-dist'; import '../css/styles.css'; -const hideBrandingSections = () => { - const nav = document.querySelector('nav'); - if (nav) { - nav.style.display = 'none'; - } - - const heroSection = document.getElementById('hero-section'); - if (heroSection) { - heroSection.style.display = 'none'; - } - - const featuresSection = document.getElementById('features-section'); - if (featuresSection) { - featuresSection.style.display = 'none'; - } - - const securitySection = document.getElementById( - 'security-compliance-section' - ); - if (securitySection) { - securitySection.style.display = 'none'; - } - - const faqSection = document.getElementById('faq-accordion'); - if (faqSection) { - faqSection.style.display = 'none'; - } - - const testimonialsSection = document.getElementById('testimonials-section'); - if (testimonialsSection) { - testimonialsSection.style.display = 'none'; - } - - const supportSection = document.getElementById('support-section'); - if (supportSection) { - supportSection.style.display = 'none'; - } - - const footer = document.querySelector('footer'); - if (footer) { - footer.style.display = 'none'; - } - - const sectionDividers = document.querySelectorAll('.section-divider'); - sectionDividers.forEach((divider) => { - (divider as HTMLElement).style.display = 'none'; - }); - - document.title = 'PDF Tools'; - - const toolsHeader = document.getElementById('tools-header'); - if (toolsHeader) { - const title = toolsHeader.querySelector('h2'); - const subtitle = toolsHeader.querySelector('p'); - if (title) { - title.textContent = 'PDF Tools'; - title.className = 'text-4xl md:text-5xl font-bold text-white mb-3'; - } - if (subtitle) { - subtitle.textContent = 'Select a tool to get started'; - subtitle.className = 'text-lg text-gray-400'; - } - } - - const app = document.getElementById('app'); - if (app) { - app.style.paddingTop = '2rem'; - } -}; - const init = () => { pdfjsLib.GlobalWorkerOptions.workerSrc = new URL( 'pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url ).toString(); - // Handle simple mode - hide branding sections + // Handle simple mode - hide branding sections but keep logo and copyright if (__SIMPLE_MODE__) { + const hideBrandingSections = () => { + // Hide navigation but keep logo + const nav = document.querySelector('nav'); + if (nav) { + // Hide the entire nav but we'll create a minimal one with just logo + nav.style.display = 'none'; + + // Create a simple nav with just logo on the right + const simpleNav = document.createElement('nav'); + simpleNav.className = 'bg-gray-800 border-b border-gray-700 sticky top-0 z-30'; + simpleNav.innerHTML = ` +
+ © 2025 BentoPDF. All rights reserved. +
+