This guide provides detailed instructions for publishing the Lighthouse Docker image to Docker Hub.
Open your terminal and login:
docker login
Enter your Docker Hub username and password when prompted.
Navigate to the project directory and build:
cd lighthouse-docker
docker build -t yourusername/lighthouse-docker:latest .
Replace yourusername with your actual Docker Hub username.
It's a good practice to tag with both a specific version and latest:
docker tag saeedp/lighthouse-docker:latest saeedp/lighthouse-docker:1.0.0
Or build with multiple tags at once:
docker build -t saeedp/lighthouse-docker:1.0.0 -t saeedp/lighthouse-docker:latest .
Before pushing, verify the image works:
docker run -d -p 3000:3000 --cap-add=SYS_ADMIN yourusername/lighthouse-docker:latest
Open http://localhost:3000 and test the service.
Push both tags:
docker push saeedp/lighthouse-docker:1.0.0
docker push saeedp/lighthouse-docker:latest
Copy and paste the following to your Docker Hub repository's "Overview" section:
# š Lighthouse Docker - Web Performance Auditing Service
A lightweight, containerized Google Lighthouse audit service with a user-friendly web interface and REST API. Built on Alpine Linux with the latest Node.js, Chromium, and Lighthouse.
## Quick Start
```bash
docker run -d -p 3000:3000 --cap-add=SYS_ADMIN saeedp/lighthouse-docker:latest
Then open http://localhost:3000ā in your browser.
services:
lighthouse:
image: saeedp/lighthouse-docker:latest
container_name: lighthouse_docker
ports:
- "3000:3000"
cap_add:
- SYS_ADMIN
curl "http://localhost:3000/api/analyze?url=https://example.com"
Returns complete Lighthouse report with all metrics and scores.
curl "http://localhost:3000/api/analyze?url=https://example.com&metrics=speed-index,fcp,lcp,performance"
Returns only the requested metrics in a compact JSON format.
curl "http://localhost:3000/analyze?url=https://example.com" > report.html
Category Scores (0-100):
performance - Performance scoreaccessibility - Accessibility scorebest-practices - Best practices scoreseo - SEO scorePerformance Metrics (milliseconds):
speed-index - Speed Indexfcp - First Contentful Paintlcp - Largest Contentful Painttti - Time to Interactivetbt - Total Blocking Timecls - Cumulative Layout Shiftlatest - Latest stable release (recommended)1.0.0 - Specific version for production stabilitySYS_ADMIN capability (required for Chrome to run in Docker)GitHub Actions:
- name: Run Lighthouse Audit
run: |
docker run -d -p 3000:3000 --cap-add=SYS_ADMIN saeedp/lighthouse-docker:latest
sleep 5
curl "http://localhost:3000/api/analyze?url=https://mysite.com&metrics=performance,speed-index" > metrics.json
Node.js:
const response = await fetch('http://localhost:3000/api/analyze?url=https://example.com&metrics=performance,fcp,lcp');
const metrics = await response.json();
console.log(`Performance Score: ${metrics.metrics.performance}`);
Python:
import requests
response = requests.get('http://localhost:3000/api/analyze', params={
'url': 'https://example.com',
'metrics': 'performance,speed-index,fcp'
})
metrics = response.json()
print(f"Performance: {metrics['metrics']['performance']}")
MIT License - Free for personal and commercial use
ā If you find this useful, please star the repository!
š Found a bug? Open an issue on GitHub.
š¬ Questions? Check the documentation or open a discussion.
**Note**: Remember to replace GitHub URLs with your actual repository URLs.
## Multi-Platform Support (Optional)
To support both AMD64 and ARM64 architectures:
### 1. Create a Builder
```bash
docker buildx create --name multiplatform --use
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64,linux/arm64 \
-t yourusername/lighthouse-docker:latest \
-t yourusername/lighthouse-docker:1.0.0 \
--push .
This creates images for:
linux/amd64 - Intel/AMD processors (most servers, Windows, Mac Intel)linux/arm64 - ARM processors (Mac M1/M2, Raspberry Pi, ARM servers)Create .github/workflows/docker-publish.yml:
name: Publish Docker Image
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: yourusername/lighthouse-docker
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Then create a tag to trigger:
git tag v1.0.0
git push origin v1.0.0
Follow semantic versioning: MAJOR.MINOR.PATCH
Always push:
1.0.0, 1.0.1, 1.1.01.0, 1.1latestExample:
docker tag yourusername/lighthouse-docker:1.0.1 yourusername/lighthouse-docker:1.0
docker tag yourusername/lighthouse-docker:1.0.1 yourusername/lighthouse-docker:latest
docker push yourusername/lighthouse-docker:1.0.1
docker push yourusername/lighthouse-docker:1.0
docker push yourusername/lighthouse-docker:latest
docker scout cves yourusername/lighthouse-docker:latest
When you make changes:
# Build new version
docker build -t yourusername/lighthouse-docker:1.0.1 -t yourusername/lighthouse-docker:latest .
# Push
docker push yourusername/lighthouse-docker:1.0.1
docker push yourusername/lighthouse-docker:latest
Check your image stats on Docker Hub:
Enable automated builds to rebuild on base image updates.
Content type
Image
Digest
sha256:83999cf19ā¦
Size
420.4 MB
Last updated
10 months ago
docker pull saeedp/lighthouse-docker