An open API service indexing awesome lists of open source software.

https://github.com/jonlabelle/docker-magika

Docker image for Magika, a novel AI-powered file type detection tool that relies on the recent advance of deep learning to provide accurate detection.
https://github.com/jonlabelle/docker-magika

ai docker google magika

Last synced: 7 days ago
JSON representation

Docker image for Magika, a novel AI-powered file type detection tool that relies on the recent advance of deep learning to provide accurate detection.

Awesome Lists containing this project

README

          

# Docker Magika

[![cd](https://github.com/jonlabelle/docker-magika/actions/workflows/cd.yml/badge.svg)](https://github.com/jonlabelle/docker-magika/actions/workflows/cd.yml)
[![docker pulls](https://img.shields.io/docker/pulls/jonlabelle/magika)](https://hub.docker.com/r/jonlabelle/magika)
[![image size](https://img.shields.io/docker/image-size/jonlabelle/magika/latest?label=image%20size)](https://hub.docker.com/r/jonlabelle/magika/tags)

> Docker image for [Magika](https://securityresearch.google/magika/introduction/overview), a novel AI-powered file type detection tool that relies on the recent advance of deep learning to provide accurate detection.

## Quick start

```bash
# Show Magika CLI help (default command)
docker run --rm jonlabelle/magika:latest

# Show version
docker run --rm jonlabelle/magika:latest --version

# Scan a file from the current directory
docker run --rm -v "$PWD:/workspace:ro" jonlabelle/magika:latest README.md

# Scan files matching a shell glob (expanded by your shell)
docker run --rm -v "$PWD:/workspace:ro" jonlabelle/magika:latest *.md

# Recursively scan all files in the current directory tree
docker run --rm -v "$PWD:/workspace:ro" jonlabelle/magika:latest --recursive .
```

## Image details

- Base image: `python:slim`
- Entrypoint: compatibility wrapper (via `entrypoint.sh`) that prefers `magika` and falls back to `magika-python-client` when needed
- Default command: `--help`
- Runtime user: non-root (`magika`)
- Working directory: `/workspace` (so mounted files can be referenced relatively)
- Magika package: latest from PyPI (`pip install magika`)
- Architectures: `linux/amd64`, `linux/arm64`
- Note: On platforms without Rust CLI wheels, the wrapper automatically uses `magika-python-client`

## Tags

- `latest`
- `sha-`

## Local development

```bash
make lint
make build
make run ARGS="--version"
make run ARGS="README.md"
```

If `docker` is unavailable, the `Makefile` also supports `podman` and `nerdctl`.

## Publishing

GitHub Actions (`.github/workflows/cd.yml`) builds and publishes multi-arch images to:

- Docker Hub: `jonlabelle/magika`
- GHCR: `ghcr.io/jonlabelle/magika`

The same workflow runs post-publish registry pruning via [`scripts/prune`](scripts/prune).