Add Docker support with documentation

This commit is contained in:
Edward Rafalovsky
2024-12-04 23:41:36 +01:00
parent cad03dc3b4
commit 42c2aad685
2 changed files with 49 additions and 0 deletions

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM php:8.2-cli
# Install dependencies
RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
&& docker-php-ext-install zip
WORKDIR /scanner
COPY . .
RUN chmod +x scan
ENTRYPOINT ["./scan"]
CMD ["/code"]

View File

@@ -146,3 +146,37 @@ Licensing
---------
PHP malware scanner is [licensed](https://github.com/scr34m/php-malware-scanner/blob/master/LICENSE.txt) under the GNU General Public License v3.
Docker Usage
-----------
You can also run the scanner using Docker:
1. Build the image:
```bash
docker build -t php-malware-scanner .
```
2. Scan a directory:
```bash
docker run -v /path/to/scan:/code php-malware-scanner -d /code
```
For example, to scan a WordPress installation:
```bash
docker run -v /var/www/html:/code php-malware-scanner -d /code -j 6.4.1
```
Common usage with flags:
```bash
# Show only infected files (hide OK status)
docker run -v /path/to/scan:/code php-malware-scanner -d /code -k
# Show comments for matched patterns
docker run -v /path/to/scan:/code php-malware-scanner -d /code -c
# Show MD5 hashes and continue after first match
docker run -v /path/to/scan:/code php-malware-scanner -d /code -m -s
```
The `/code` directory inside the container is where your files will be mounted for scanning.