mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-06 22:19:01 +00:00
Add Docker web image with multi-stage building
This commit is contained in:
@@ -2,7 +2,7 @@ name: Build docker image and push to DockerHub
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main, dev ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@@ -10,24 +10,62 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v3
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v3
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Extract metadata (CLI)
|
||||||
id: docker_build
|
id: meta_cli
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKER_HUB_USERNAME }}/maigret
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=sha,prefix=
|
||||||
|
-
|
||||||
|
name: Extract metadata (Web UI)
|
||||||
|
id: meta_web
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKER_HUB_USERNAME }}/maigret
|
||||||
|
tags: |
|
||||||
|
type=raw,value=web,enable={{is_default_branch}}
|
||||||
|
type=ref,event=branch,suffix=-web
|
||||||
|
type=sha,prefix=web-
|
||||||
|
-
|
||||||
|
name: Build and push (CLI, default)
|
||||||
|
id: docker_build_cli
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/maigret:latest
|
target: cli
|
||||||
|
tags: ${{ steps.meta_cli.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta_cli.outputs.labels }}
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
-
|
-
|
||||||
name: Image digest
|
name: Build and push (Web UI)
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
id: docker_build_web
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
target: web
|
||||||
|
tags: ${{ steps.meta_web.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta_web.outputs.labels }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
-
|
||||||
|
name: Image digests
|
||||||
|
run: |
|
||||||
|
echo "cli: ${{ steps.docker_build_cli.outputs.digest }}"
|
||||||
|
echo "web: ${{ steps.docker_build_web.outputs.digest }}"
|
||||||
|
|||||||
+10
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.11-slim
|
FROM python:3.11-slim AS base
|
||||||
LABEL maintainer="Soxoj <soxoj@protonmail.com>"
|
LABEL maintainer="Soxoj <soxoj@protonmail.com>"
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN pip install --no-cache-dir --upgrade pip
|
RUN pip install --no-cache-dir --upgrade pip
|
||||||
@@ -15,4 +15,13 @@ COPY . .
|
|||||||
RUN YARL_NO_EXTENSIONS=1 python3 -m pip install --no-cache-dir .
|
RUN YARL_NO_EXTENSIONS=1 python3 -m pip install --no-cache-dir .
|
||||||
# For production use, set FLASK_HOST to a specific IP address for security
|
# For production use, set FLASK_HOST to a specific IP address for security
|
||||||
ENV FLASK_HOST=0.0.0.0
|
ENV FLASK_HOST=0.0.0.0
|
||||||
|
|
||||||
|
# Web UI variant: auto-launches the web interface on $PORT
|
||||||
|
FROM base AS web
|
||||||
|
ENV PORT=5000
|
||||||
|
EXPOSE 5000
|
||||||
|
ENTRYPOINT ["sh", "-c", "exec maigret --web \"$PORT\""]
|
||||||
|
|
||||||
|
# Default variant (last stage = `docker build .` target): CLI, backwards-compatible
|
||||||
|
FROM base AS cli
|
||||||
ENTRYPOINT ["maigret"]
|
ENTRYPOINT ["maigret"]
|
||||||
|
|||||||
@@ -140,15 +140,27 @@ maigret username
|
|||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
|
Two image variants are published:
|
||||||
|
|
||||||
|
- `soxoj/maigret:latest` — CLI mode (default)
|
||||||
|
- `soxoj/maigret:web` — auto-launches the [web interface](#web-interface)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# official image
|
# official image (CLI)
|
||||||
docker pull soxoj/maigret
|
docker pull soxoj/maigret
|
||||||
|
|
||||||
# usage
|
# CLI usage
|
||||||
docker run -v /mydir:/app/reports soxoj/maigret:latest username --html
|
docker run -v /mydir:/app/reports soxoj/maigret:latest username --html
|
||||||
|
|
||||||
|
# Web UI (open http://localhost:5000)
|
||||||
|
docker run -p 5000:5000 soxoj/maigret:web
|
||||||
|
|
||||||
|
# Web UI on a custom port
|
||||||
|
docker run -e PORT=8080 -p 8080:8080 soxoj/maigret:web
|
||||||
|
|
||||||
# manual build
|
# manual build
|
||||||
docker build -t maigret .
|
docker build -t maigret . # CLI image (default target)
|
||||||
|
docker build --target web -t maigret-web . # Web UI image
|
||||||
```
|
```
|
||||||
|
|
||||||
### Troubleshooting
|
### Troubleshooting
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"updated_at": "2026-04-25T16:11:27Z",
|
"updated_at": "2026-04-26T09:18:14Z",
|
||||||
"sites_count": 3139,
|
"sites_count": 3139,
|
||||||
"min_maigret_version": "0.6.0",
|
"min_maigret_version": "0.6.0",
|
||||||
"data_sha256": "c51ecaa6c0736c5e1e7ca91aaf111445b3ac9ce9541a472d97db2dcc3ff8aa17",
|
"data_sha256": "c51ecaa6c0736c5e1e7ca91aaf111445b3ac9ce9541a472d97db2dcc3ff8aa17",
|
||||||
|
|||||||
@@ -3143,7 +3143,7 @@ Rank data fetched from Majestic Million by domains.
|
|||||||
1.  [flarum.es (https://flarum.es)](https://flarum.es)*: top 100M, es, forum*
|
1.  [flarum.es (https://flarum.es)](https://flarum.es)*: top 100M, es, forum*
|
||||||
1.  [forum.fibra.click (https://forum.fibra.click)](https://forum.fibra.click)*: top 100M, forum, it*
|
1.  [forum.fibra.click (https://forum.fibra.click)](https://forum.fibra.click)*: top 100M, forum, it*
|
||||||
|
|
||||||
The list was updated at (2026-04-25)
|
The list was updated at (2026-04-26)
|
||||||
## Statistics
|
## Statistics
|
||||||
|
|
||||||
Enabled/total sites: 2510/3139 = 79.96%
|
Enabled/total sites: 2510/3139 = 79.96%
|
||||||
|
|||||||
Reference in New Issue
Block a user