|
| 1 | +# Docker Usage |
| 2 | + |
| 3 | +This document explains how to use progpilot with Docker. |
| 4 | + |
| 5 | +## Building the Docker Image |
| 6 | + |
| 7 | +```bash |
| 8 | +docker build -t progpilot . |
| 9 | +``` |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +### Basic Usage |
| 14 | + |
| 15 | +```bash |
| 16 | +# Analyze a single PHP file |
| 17 | +docker run -v $(pwd):/workspace progpilot /workspace/path/to/your/file.php |
| 18 | + |
| 19 | +# Analyze multiple files |
| 20 | +docker run -v $(pwd):/workspace progpilot /workspace/file1.php /workspace/file2.php /workspace/file3.php |
| 21 | + |
| 22 | +# Analyze a directory |
| 23 | +docker run -v $(pwd):/workspace progpilot /workspace/path/to/your/php/project/ |
| 24 | + |
| 25 | +# Use with configuration file |
| 26 | +docker run -v $(pwd):/workspace progpilot /workspace/file.php --configuration /workspace/config.yml |
| 27 | +``` |
| 28 | + |
| 29 | +### Examples |
| 30 | + |
| 31 | +```bash |
| 32 | +# Analyze current directory (mount current directory) |
| 33 | +docker run -v $(pwd):/workspace progpilot /workspace/ |
| 34 | + |
| 35 | +# Analyze with custom configuration |
| 36 | +docker run -v $(pwd):/workspace progpilot /workspace/ --configuration /workspace/progpilot.yml |
| 37 | + |
| 38 | +# Analyze specific files in current directory |
| 39 | +docker run -v $(pwd):/workspace progpilot /workspace/index.php /workspace/config.php |
| 40 | + |
| 41 | +# Test with the example file |
| 42 | +docker run -v $(pwd):/workspace progpilot /workspace/projects/example/source_code1.php |
| 43 | +``` |
| 44 | + |
| 45 | +## Volume Mounting |
| 46 | + |
| 47 | +Since the container needs access to your PHP files, you'll need to mount volumes: |
| 48 | + |
| 49 | +- `-v $(pwd):/workspace`: Mount your current directory to `/workspace` in the container |
| 50 | +- Use absolute paths inside the container for the files/directories you want to analyze |
| 51 | +- The `/workspace` path inside the container corresponds to your current directory |
| 52 | + |
| 53 | +## Configuration Files |
| 54 | + |
| 55 | +If you're using a configuration file, make sure to: |
| 56 | +1. Mount the directory containing your config file |
| 57 | +2. Use the container path when referencing the config file |
| 58 | + |
| 59 | +## Notes |
| 60 | + |
| 61 | +- The container builds the progpilot phar file during the build process |
| 62 | +- All arguments passed to the container are forwarded to the progpilot command |
| 63 | +- The container uses PHP 8.1 which is compatible with the project requirements (>=7.4) |
| 64 | +- Make sure to use the correct file paths when mounting volumes |
0 commit comments