feat: switch GitHub Actions to build optimized Docker image by default

- Change main build to use Dockerfile.optimized (targets ~200MB image)
- Add separate 'full' build job for development variant (2.6GB)
- Update tagging strategy: 'latest' for optimized, 'full' suffix for full variant
- Update documentation to reflect dual image strategy
- Update docker-compose.yml with variant selection comment

This provides users with two options:
- Optimized (default): Pre-built database, minimal size, for production
- Full: Complete n8n packages, dynamic scanning, for development

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-06-14 11:27:24 +02:00
parent 3ab8fbd60b
commit e90971b2d8
5 changed files with 108 additions and 13 deletions

View File

@@ -17,8 +17,8 @@ env:
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build-simple: build-optimized:
name: Build Simple Docker Image name: Build Optimized Docker Image
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
@@ -56,15 +56,68 @@ jobs:
type=sha,prefix={{branch}}-,format=short type=sha,prefix={{branch}}-,format=short
type=raw,value=latest,enable={{is_default_branch}} type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push simple Docker image - name: Build and push optimized Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.optimized
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILDKIT_INLINE_CACHE=1
provenance: false
# Keep standard build as 'full' variant
build-full:
name: Build Full Docker Image (with n8n packages)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for full variant
id: meta-full
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch,suffix=-full
type=ref,event=pr,suffix=-full
type=semver,pattern={{version}}-full
type=semver,pattern={{major}}.{{minor}}-full
type=raw,value=full,enable={{is_default_branch}}
- name: Build and push full Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
file: ./Dockerfile file: ./Dockerfile
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta-full.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta-full.outputs.labels }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
build-args: | build-args: |

View File

@@ -65,7 +65,9 @@ npm run test-nodes
## Docker Quick Start 🐳 ## Docker Quick Start 🐳
The easiest way to get started is using Docker: The easiest way to get started is using Docker. We provide two image variants:
- **Optimized** (`latest`): ~200MB, pre-built database, recommended for production
- **Full** (`full`): 2.6GB, includes n8n packages, for development/dynamic scanning
### Option 1: Simple HTTP Server (Recommended) ### Option 1: Simple HTTP Server (Recommended)

View File

@@ -3,6 +3,7 @@ version: '3.8'
services: services:
n8n-mcp: n8n-mcp:
# Use 'latest' for optimized image (~200MB) or 'full' for development (2.6GB)
image: ghcr.io/czlonkowski/n8n-mcp:latest image: ghcr.io/czlonkowski/n8n-mcp:latest
container_name: n8n-mcp container_name: n8n-mcp
restart: unless-stopped restart: unless-stopped

View File

@@ -33,10 +33,11 @@ curl http://localhost:3000/health
### 2. Using Pre-built Images ### 2. Using Pre-built Images
Pre-built images are available on GitHub Container Registry: Pre-built images are available on GitHub Container Registry in two variants:
#### Optimized Image (Recommended)
```bash ```bash
# Pull the latest image # Pull the optimized image (~200MB)
docker pull ghcr.io/czlonkowski/n8n-mcp:latest docker pull ghcr.io/czlonkowski/n8n-mcp:latest
# Run with HTTP mode # Run with HTTP mode
@@ -45,10 +46,24 @@ docker run -d \
-e MCP_MODE=http \ -e MCP_MODE=http \
-e AUTH_TOKEN=your-secure-token \ -e AUTH_TOKEN=your-secure-token \
-p 3000:3000 \ -p 3000:3000 \
-v n8n-mcp-data:/app/data \
ghcr.io/czlonkowski/n8n-mcp:latest ghcr.io/czlonkowski/n8n-mcp:latest
``` ```
#### Full Image (Development)
```bash
# Pull the full image with n8n packages (2.6GB)
docker pull ghcr.io/czlonkowski/n8n-mcp:full
# Run with dynamic node scanning capability
docker run -d \
--name n8n-mcp-full \
-e MCP_MODE=http \
-e AUTH_TOKEN=your-secure-token \
-p 3000:3000 \
-v n8n-mcp-data:/app/data \
ghcr.io/czlonkowski/n8n-mcp:full
```
## 📋 Configuration Options ## 📋 Configuration Options
### Environment Variables ### Environment Variables
@@ -424,14 +439,31 @@ secrets:
## 📦 Available Images ## 📦 Available Images
- `ghcr.io/czlonkowski/n8n-mcp:latest` - Latest stable release ### Optimized Images (~200MB)
- `ghcr.io/czlonkowski/n8n-mcp:2.3.0` - Specific version - `ghcr.io/czlonkowski/n8n-mcp:latest` - Latest optimized release
- `ghcr.io/czlonkowski/n8n-mcp:main-abc123` - Development builds - `ghcr.io/czlonkowski/n8n-mcp:2.3.0` - Specific version (optimized)
- `ghcr.io/czlonkowski/n8n-mcp:main-abc123` - Development builds (optimized)
### Full Images (2.6GB)
- `ghcr.io/czlonkowski/n8n-mcp:full` - Latest full release
- `ghcr.io/czlonkowski/n8n-mcp:2.3.0-full` - Specific version (full)
- `ghcr.io/czlonkowski/n8n-mcp:main-full` - Development builds (full)
### Image Details ### Image Details
#### Optimized Variant
- Base: `node:20-alpine` - Base: `node:20-alpine`
- Size: ~150MB compressed - Size: ~200MB compressed
- Features: Pre-built database, minimal runtime
- Use case: Production deployments
#### Full Variant
- Base: `node:20-alpine`
- Size: ~2.6GB compressed
- Features: Full n8n packages, dynamic scanning
- Use case: Development, custom nodes
Both variants:
- Architectures: `linux/amd64`, `linux/arm64` - Architectures: `linux/amd64`, `linux/arm64`
- Updated: Automatically via GitHub Actions - Updated: Automatically via GitHub Actions

View File

@@ -15,11 +15,18 @@ git push origin v1.2.3
``` ```
This will automatically create the following Docker tags: This will automatically create the following Docker tags:
**Optimized Images:**
- `ghcr.io/czlonkowski/n8n-mcp:1.2.3` (exact version) - `ghcr.io/czlonkowski/n8n-mcp:1.2.3` (exact version)
- `ghcr.io/czlonkowski/n8n-mcp:1.2` (minor version) - `ghcr.io/czlonkowski/n8n-mcp:1.2` (minor version)
- `ghcr.io/czlonkowski/n8n-mcp:1` (major version) - `ghcr.io/czlonkowski/n8n-mcp:1` (major version)
- `ghcr.io/czlonkowski/n8n-mcp:latest` (if from main branch) - `ghcr.io/czlonkowski/n8n-mcp:latest` (if from main branch)
**Full Images:**
- `ghcr.io/czlonkowski/n8n-mcp:1.2.3-full` (exact version)
- `ghcr.io/czlonkowski/n8n-mcp:1.2-full` (minor version)
- `ghcr.io/czlonkowski/n8n-mcp:full` (if from main branch)
## Tag Types Explained ## Tag Types Explained
### Latest Tag ### Latest Tag