|
1 | 1 | [](https://www.buymeacoffee.com/robco) |
2 | | -# Robot Framework Docker Runner |
| 2 | +# Robot Framework Multi-Platform Docker Image |
3 | 3 |
|
4 | | -A multi-platform Docker image for running Robot Framework tests seamlessly across **x64** and **Apple Silicon/ARM** architectures. Built on Alpine Linux for minimal footprint and maximum performance. |
| 4 | +[](https://hub.docker.com/r/malovec/robot-runner) |
| 5 | +[](https://hub.docker.com/r/malovec/docker-robot-runner) |
| 6 | +[](https://www.python.org/) |
| 7 | +[](https://robotframework.org/) |
5 | 8 |
|
6 | | -## Features |
| 9 | +A hardened, multi-platform Docker image for running Robot Framework test automation across x64 and ARM architectures (including Apple Silicon). This image provides a secure, portable environment for test execution with built-in support for performance testing tools. |
7 | 10 |
|
8 | | -- **Multi-Architecture Support**: Pre-built images for both `linux/amd64` and `linux/arm64` |
9 | | -- **Batteries Included**: Pre-installed with Robot Framework, browser automation tools, and testing utilities |
10 | | -- **Lightweight**: Based on Alpine Linux for fast downloads and minimal resource usage |
11 | | -- **Production Ready**: Industry-standard security practices and optimized layers |
12 | | -- **Flexible**: Easy to extend with your own test suites and dependencies |
| 11 | +## π Features |
13 | 12 |
|
14 | | -## What's Included |
| 13 | +- **Multi-Architecture Support**: Runs seamlessly on x64, ARM, and Apple Silicon |
| 14 | +- **Hardened Security**: Built on Docker's official hardened Python base image |
| 15 | +- **Pre-installed Tools**: |
| 16 | + - Robot Framework 6.1+ |
| 17 | + - Apache JMeter 5.6.3 for performance testing |
| 18 | + - Modern Python 3.12 environment |
| 19 | + - Alpine Linux-based for minimal footprint |
| 20 | +- **Flexible Execution**: Run Robot tests, JMeter scripts, or any custom command |
| 21 | +- **Optimized Dependencies**: Pre-cached package installation for faster builds |
15 | 22 |
|
16 | | -### Core Components |
17 | | -- **Robot Framework** - Test automation framework |
18 | | -- **Python 3.12** - Modern Python version with full Robot Framework ecosystem |
19 | | -- **JMeter 5.6.3** - Performance testing integration |
20 | | -- **Node.js/NPM** - JavaScript testing capabilities |
| 23 | +## π Quick Start |
21 | 24 |
|
22 | | -### Pre-installed Dependencies |
23 | | -- Browser automation libraries |
24 | | -- API testing tools |
25 | | -- Database connectors |
26 | | -- XML/JSON processing utilities |
27 | | -- And much more! |
| 25 | +### Basic Robot Framework Execution |
28 | 26 |
|
29 | | -### Project structure |
| 27 | +```bash |
| 28 | +docker run --rm -v $(pwd):/robot malovec/robot-runner:latest tests/suite.robot |
30 | 29 | ``` |
31 | | -. |
32 | | -βββ Dockerfile # Multi-stage build configuration |
33 | | -βββ requirements/ |
34 | | -β βββ apk.in # Alpine Linux packages |
35 | | -β βββ npm.in # Node.js packages |
36 | | -β βββ python.in # Python dependencies |
37 | | -βββ scripts/ |
38 | | -β βββ install-apk-from-file.sh # Package installation helper |
39 | | -βββ entrypoint.sh # Container entrypoint |
| 30 | + |
| 31 | +### Running JMeter Tests |
| 32 | + |
| 33 | +```bash |
| 34 | +docker run --rm -v $(pwd):/robot -e CMD=jmeter malovec/robot-runner:latest -n -t Summary-Report.jmx -l Summary-Report.jtl |
40 | 35 | ``` |
41 | 36 |
|
42 | | -## Quick Start |
| 37 | +### Interactive Shell Access |
43 | 38 |
|
44 | | -### Run Basic Tests |
45 | 39 | ```bash |
46 | | -docker run --rm -v $(pwd)/tests:/tests malovec/robot-runner:latest -d results /tests/test.robot |
| 40 | +docker run --rm -ti -e CMD=bash malovec/robot-runner:latest |
47 | 41 | ``` |
48 | 42 |
|
49 | | -### Use as Base Image |
50 | | -```dockerfile |
51 | | -FROM malovec/robot-runner:latest |
| 43 | +## π¦ Image Contents |
52 | 44 |
|
53 | | -COPY your-tests /robot/tests |
54 | | -COPY requirements /robot/requirements |
| 45 | +### Pre-installed Packages |
55 | 46 |
|
56 | | -# Add additional dependencies if needed |
57 | | -RUN pip install -r /robot/requirements/python.in |
58 | | -``` |
| 47 | +**Python Libraries:** |
| 48 | +- Robot Framework 7.x |
| 49 | +- Browser and SeleniumLibrary for web testing |
| 50 | +- Appium Library for mobile testing |
| 51 | +- Requests library for API testing |
| 52 | +- All major Robot Framework ecosystem packages |
| 53 | + |
| 54 | +**System Tools:** |
| 55 | +- Apache JMeter 5.x |
| 56 | +- Node.js/npm packages for modern web testing |
| 57 | +- Alpine Linux system dependencies |
| 58 | + |
| 59 | +## π οΈ Usage Examples |
| 60 | + |
| 61 | +### 1. Run Robot Tests with Output Directory |
59 | 62 |
|
60 | | -### Custom Command Execution |
61 | 63 | ```bash |
62 | | -# Run specific Robot Framework command |
63 | | -docker run --rm -v $(pwd):/robot malovec/robot-runner:latest -v VARIABLE:value your_test.robot |
| 64 | +docker run --rm \ |
| 65 | + -v $(pwd):/robot \ |
| 66 | + malovec/robot-runner:latest \ |
| 67 | + --outputdir results tests/ |
| 68 | +``` |
64 | 69 |
|
65 | | -# Execute custom commands |
66 | | -docker run --rm malovec/robot-runner:latest CMD="python -c \"print('Hello from Robot!')\"" |
| 70 | +### 2. Run Specific Robot Suite with Variables |
| 71 | + |
| 72 | +```bash |
| 73 | +docker run --rm \ |
| 74 | + -v $(pwd):/robot \ |
| 75 | + malovec/robot-runner:latest \ |
| 76 | + --variable BROWSER:chrome \ |
| 77 | + --suite smoke_tests tests/suite.robot |
67 | 78 | ``` |
68 | 79 |
|
69 | | -## Advanced Usage |
| 80 | +### 3. Execute JMeter with Custom Properties |
70 | 81 |
|
71 | | -### Multi-stage Build Integration |
72 | | -```dockerfile |
73 | | -# Development stage |
74 | | -FROM malovec/robot-runner:latest as dev |
75 | | -RUN pip install additional-dev-packages |
| 82 | +```bash |
| 83 | +docker run --rm \ |
| 84 | + -v $(pwd):/robot \ |
| 85 | + -e CMD=jmeter \ |
| 86 | + malovec/robot-runner:latest \ |
| 87 | + -Jthreads=10 -Jduration=300 -n -t load_test.jmx -l results.jtl |
| 88 | +``` |
| 89 | + |
| 90 | +### 4. Run Custom Python Scripts |
76 | 91 |
|
77 | | -# Production stage |
78 | | -FROM malovec/robot-runner:latest |
79 | | -COPY --from=dev /opt/venv /opt/venv |
| 92 | +```bash |
| 93 | +docker run --rm \ |
| 94 | + -v $(pwd):/robot \ |
| 95 | + -e CMD=python \ |
| 96 | + malovec/robot-runner:latest \ |
| 97 | + my_script.py |
80 | 98 | ``` |
81 | 99 |
|
82 | | -### CI/CD Pipeline Integration |
83 | | -The image works seamlessly with GitHub Actions, GitLab CI, Jenkins, and other CI/CD platforms. See our [GitHub Actions workflow](#github-actions) example below. |
| 100 | +## π§ Advanced Configuration |
| 101 | + |
| 102 | +### Volume Mounts for Data Persistence |
84 | 103 |
|
85 | | -## Architecture Support |
| 104 | +```bash |
| 105 | +# Mount current directory and specific output directory |
| 106 | +docker run --rm \ |
| 107 | + -v $(pwd)/tests:/robot/tests \ |
| 108 | + -v $(pwd)/results:/robot/results \ |
| 109 | + malovec/robot-runner:latest \ |
| 110 | + --outputdir /robot/results /robot/tests |
| 111 | +``` |
86 | 112 |
|
87 | | -This image supports both modern architectures: |
88 | | -- **linux/amd64**: Traditional 64-bit Intel/AMD processors |
89 | | -- **linux/arm64**: Apple Silicon (M1/M2/M3) and ARM64 servers |
| 113 | +### Environment Variable Configuration |
90 | 114 |
|
91 | | -## GitHub Actions |
| 115 | +```bash |
| 116 | +docker run --rm \ |
| 117 | + -v $(pwd):/robot \ |
| 118 | + -e PYTHONPATH=/robot/lib \ |
| 119 | + -e ROBOT_OPTIONS="--loglevel DEBUG" \ |
| 120 | + malovec/robot-runner:latest |
| 121 | +``` |
92 | 122 |
|
93 | | -This repository includes a ready-to-use GitHub Actions workflow for building and testing multi-architecture images: |
| 123 | +### Docker Compose Integration |
94 | 124 |
|
95 | 125 | ```yaml |
96 | | -# See publish.yml for complete workflow |
97 | | -- name: Build multi-arch image |
98 | | - uses: docker/build-push-action@v6 |
99 | | - with: |
100 | | - platforms: linux/amd64,linux/arm64 |
101 | | - tags: malovec/robot-runner:latest,malovec/robot-runner:3.0 |
| 126 | +version: '3.8' |
| 127 | +services: |
| 128 | + robot-tests: |
| 129 | + image: malovec/robot-runner:latest |
| 130 | + volumes: |
| 131 | + - ./tests:/robot/tests |
| 132 | + - ./results:/robot/results |
| 133 | + command: --outputdir /robot/results /robot/tests/smoke.robot |
| 134 | +``` |
| 135 | +
|
| 136 | +## ποΈ Building from Source |
| 137 | +
|
| 138 | +### Build for Multiple Architectures |
| 139 | +
|
| 140 | +```bash |
| 141 | +# Build for both x64 and ARM |
| 142 | +docker buildx build --platform linux/amd64,linux/arm64 \ |
| 143 | + -t malovec/robot-runner:latest \ |
| 144 | + --push . |
102 | 145 | ``` |
103 | 146 |
|
| 147 | +### Custom Python Version |
| 148 | + |
| 149 | +```bash |
| 150 | +# Build with specific Python version |
| 151 | +docker build --build-arg DHI_PYTHON_BUILD_TAG=3.11-alpine3.22-dev \ |
| 152 | + -t my-robot-runner:custom . |
| 153 | +``` |
| 154 | + |
| 155 | +## π Security Features |
| 156 | + |
| 157 | +- Built on Docker's hardened Python base image |
| 158 | +- Non-root user execution support |
| 159 | +- Minimal Alpine Linux base for reduced attack surface |
| 160 | +- Regular security updates from upstream bases |
| 161 | +- Python bytecode writing disabled (`PYTHONDONTWRITEBYTECODE=1`) |
| 162 | + |
| 163 | +## π Requirements File Structure |
| 164 | + |
| 165 | +The image uses a structured approach for dependencies: |
| 166 | + |
| 167 | +``` |
| 168 | +requirements/ |
| 169 | +βββ apk.in # Alpine Linux packages |
| 170 | +βββ npm.in # Node.js packages |
| 171 | +βββ python.in # Python packages |
| 172 | +``` |
| 173 | + |
| 174 | +## π License |
| 175 | + |
| 176 | +This project is open source. Please check the respective licenses for included tools: |
| 177 | +- Robot Framework: Apache License 2.0 |
| 178 | +- Apache JMeter: Apache License 2.0 |
| 179 | +- Python: Python Software Foundation License |
| 180 | + |
| 181 | +## π Links |
| 182 | + |
| 183 | +- **Docker Hub**: [malovec/robot-runner](https://hub.docker.com/r/malovec/robot-runner) |
| 184 | +- **Robot Framework**: [robotframework.org](https://robotframework.org/) |
| 185 | +- **Apache JMeter**: [jmeter.apache.org](https://jmeter.apache.org/) |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +**Note**: This image is optimized for CI/CD pipelines and automated testing environments. For development purposes, consider using the interactive shell mode for debugging and exploration. |
104 | 190 | --- |
105 | 191 | *Built with β€οΈ for the Robot Framework community* |
0 commit comments