Skip to content

Commit f8f7246

Browse files
committed
Dockerfile, update README.md
1 parent f2895b5 commit f8f7246

File tree

4 files changed

+87
-5
lines changed

4 files changed

+87
-5
lines changed

Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.7.11-alpine3.14
2+
3+
ENV DOCKER=True
4+
5+
WORKDIR /app
6+
7+
COPY requirements.txt /tmp/
8+
RUN pip3 install --requirement /tmp/requirements.txt
9+
10+
COPY sctool ./
11+
COPY /config ./config
12+
COPY /helpers ./helpers
13+
COPY /src ./src
14+
15+
CMD ["sh", "-c", "./sctool"]

README.md

+59-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,44 @@ Automatically generating directories and `browsers.json`, `docker-compose.yaml`,
1919
- [x] standart parameters for selenoid (image, port, path)
2020
- [ ] optional parameters for selenoid (env, tmpfs, volumes, hosts, labels, sysctl, shmSize, cpu, mem)
2121
- [ ] shell-script for pull browsers images from browsers-config
22-
- [ ] Dockerfile (for usage tool into docker)
22+
- [x] Dockerfile (for usage tool into docker)
2323
- [ ] ??? Automatic deployment to tests servers via ssh
2424
- [ ] ??? Ansible playbooks
2525

26+
# Results Example
27+
```
28+
.
29+
├── ...
30+
├── results # Directory with results
31+
│ ├── ggr # Directory with ggr configs
32+
│ │ ├── 111.111.111.111 # Example IP
33+
│ │ │ ├── config
34+
│ │ │ │ └── browsers.json
35+
│ │ │ │
36+
│ │ │ ├── quota
37+
│ │ │ │ ├── dev_team.xml
38+
│ │ │ │ ├── qa_team.xml
39+
│ │ │ │ └── test_user.xml
40+
│ │ │ │
41+
│ │ │ ├── docker-compose.yaml
42+
│ │ │ └── users.htpasswd
43+
│ │ │
44+
│ │ ├── ggr-balancer.dev.example.com # Example Host
45+
│ │ └── localhost
46+
│ │
47+
│ └── selenoid # Directory with selenoid configs
48+
│ │ ├── 111.111.111.112 # Example IP
49+
│ │ │ ├── config
50+
│ │ │ │ └── browsers.json
51+
│ │ │ │
52+
│ │ │ └── docker-compose.yaml
53+
│ │ │
54+
│ │ ├── selenoid-us.dev.example.com # Example Host
55+
│ │ └── localhost
56+
│ │
57+
└── ...
58+
```
59+
2660
# Usage
2761
## Download tool
2862
1. Clone repository
@@ -158,6 +192,30 @@ python3 -m pip install -r requirements.txt
158192
./sctool -r ./your-results-dir -c ./your-config-dir
159193
```
160194

195+
## Run tool via Docker
196+
### 1. Create and fill config.yaml file
197+
```bash
198+
cd ~/selenoid-config-tool/config
199+
touch ./config.yaml
200+
```
201+
202+
### 2. Create dir for results
203+
```bash
204+
cd ~/selenoid-config-tool
205+
mkdir ./results
206+
```
207+
208+
### 3. Build docker-image
209+
```bash
210+
cd ~/selenoid-config-tool
211+
docker build -t 'sctool' .
212+
```
213+
214+
### 4. Run docker image with parameters
215+
```bash
216+
docker run --rm -v ~/selenoid-config-tool/config/config.yaml:/app/config/config.yaml -v ~/selenoid-config-tool/results/:/app/results/ sctool:latest
217+
```
218+
161219
## Results
162220
### 1. Change to the directory with the results
163221
```bash

examples/config/config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ browsers:
1919
versions: # from min and to max in steps of 1
2020
range:
2121
min: 80.0
22-
max: 99.0
22+
max: latest
2323
ignore: [82.0]
2424

2525
- type: chrome-mobile

sctool

+12-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,22 @@ def init() -> None:
2020

2121
def main() -> None:
2222
init()
23+
2324
cmd_args.config_dir = os.path.abspath(cmd_args.config_dir)
2425
cmd_args.results_dir = os.path.abspath(cmd_args.results_dir)
2526
print(cmd_args)
27+
2628
configurator = Configurator(cmd_args)
2729
configurator()
28-
print(f'Complete!\n'
29-
f'\n'
30-
f'Find your results into {cmd_args.results_dir} directory')
30+
31+
if 'DOCKER' in os.environ:
32+
print(f'Complete!\n'
33+
f'\n'
34+
f'Find your results into your host directory')
35+
else:
36+
print(f'Complete!\n'
37+
f'\n'
38+
f'Find your results into {cmd_args.results_dir} directory')
3139

3240

3341
if __name__ == '__main__':
@@ -45,4 +53,5 @@ if __name__ == '__main__':
4553
)
4654

4755
cmd_args = parser.parse_args()
56+
4857
sys.exit(main())

0 commit comments

Comments
 (0)