From fbd08753089f35230ff1584192e5ab5b091cc649 Mon Sep 17 00:00:00 2001 From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:23:43 -0500 Subject: [PATCH] Improve `./start` to work on Windows (#2421) Closes https://github.com/Qiskit/documentation/issues/1607. There are two issues: 1. The shebang will be ignored, so you need to run `python ./start` instead of `./start` 2. Volume mounting with Docker on Windows uses Unix-style path, per https://medium.com/@kale.miller96/how-to-mount-your-current-working-directory-to-your-docker-container-in-windows-74e47fa104d7 --- README.md | 1 + start | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cdb4b354da2..24dc4bfa437 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ You can preview the docs locally by following these two steps: 1. Ensure Docker is running. For example, open Rancher Desktop. 2. Run `./start` in your terminal, and open http://localhost:3000 in your browser. + - On Windows, run `python start` instead. Alternatively, use Windows Subsystem for Linux and run `./start`. The preview application does not include the top nav bar. Instead, navigate to the folder you want with the links in the home page. You can return to the home page at any time by clicking "IBM Quantum Documentation Preview" in the top-left of the header. diff --git a/start b/start index 93a737a9933..c7ea8941377 100755 --- a/start +++ b/start @@ -18,7 +18,10 @@ from pathlib import Path # Get the latest digest by running `docker pull icr.io/qc-open-source-docs-public/preview:latest`. IMAGE_DIGEST = "sha256:00708d7f6926826fbea7e1469380ffc7cdccf540760d0be1828d88c31cd7def8" -PWD = Path(__file__).parent +# Docker on Windows uses `/` rather than `\`, so we need to call `.as_posix()`: +# https://medium.com/@kale.miller96/how-to-mount-your-current-working-directory-to-your-docker-container-in-windows-74e47fa104d7 +PWD = Path(__file__).parent.as_posix() + IMAGE = f"icr.io/qc-open-source-docs-public/preview@{IMAGE_DIGEST}"