-
Notifications
You must be signed in to change notification settings - Fork 85
/
start
executable file
·57 lines (48 loc) · 1.7 KB
/
start
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
# This code is a Qiskit project.
#
# (C) Copyright IBM 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
import subprocess
from pathlib import Path
from typing import Iterator
PWD = Path(__file__).parent
def translation_volume_mounts() -> Iterator[str]:
"""Return the CLI args to mount each language in the translations/ folder.
Unlike the root `Dockerfile`, we cannot use `-v $PWD/translations:/home/node/app/docs` because
Docker complains that the volume is already mounted when we mount the `/docs` folder. So, instead
we need to be more specific to mount each language's folder.
"""
for folder in PWD.glob("translations/*"):
yield from ["-v", f"{folder}:/home/node/app/docs/{folder.name}"]
def main() -> None:
subprocess.run(
# Keep this aligned with the Dockerfile at the root of the repository.
[
"docker",
"run",
"-v",
f"{PWD}/docs:/home/node/app/docs",
*translation_volume_mounts(),
"-v",
f"{PWD}/public:/home/node/app/packages/preview/public",
"-p",
"3000:3000",
"-p",
"5001:5001",
"qiskit/documentation",
],
check=True,
)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass