You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a file called ``hello_world.sdoc`` somewhere on your file system and copy the above "Hello World" example text to it. **The file must end with a newline character**.
133
+
Create a file called ``hello.sdoc`` somewhere on your file system and copy the above "Hello World" example text to it. **The file must end with a newline character**.
134
134
135
135
Open a command-line terminal program supported on your system.
136
136
137
-
Once you have ``strictdoc`` installed (see [LINK: SDOC_UG_GETTING_STARTED] below), switch to the directory with the ``hello_world.sdoc`` file. For example, assuming that the file is now in the ``workspace/hello_world`` directory in your user folder:
137
+
Once you have ``strictdoc`` installed (see [LINK: SDOC_UG_GETTING_STARTED] below), switch to the directory with the ``hello.sdoc`` file. For example, assuming that the file is now in the ``workspace/hello_world`` directory in your user folder:
138
138
139
139
.. code-block:: text
140
140
@@ -295,25 +295,47 @@ To build the image:
295
295
296
296
.. code-block:: text
297
297
298
-
docker build . \
298
+
docker build \
299
+
./ \
299
300
--build-arg STRICTDOC_SOURCE=pypi \
300
-
-t strictdoc:latest
301
+
--tag strictdoc:latest
301
302
302
303
The ``STRICTDOC_SOURCE`` argument is optional (default value is ``pypi``) and can be used to specify which Git revision the container shall check out when installing StrictDoc with ``pip install``. Possible values: a branch name, e.g., ``main``, or a commit hash.
303
304
304
-
To run the container:
305
+
To run the container and execute StrictDoc directly:
305
306
306
307
.. code-block:: text
307
308
308
309
docker run \
309
-
--name strictdoc \
310
310
--rm \
311
-
-e HOST_UID=$(id -u) \
312
-
-e HOST_GID=$(id -g) \
313
-
-v "$(pwd):/data" \
314
-
-i -t \
311
+
--volume="$(pwd):/data/" \
312
+
--user=$(id -u):$(id -g) \
313
+
--userns=host \
314
+
--network=host \
315
+
--hostname="strictdoc" \
316
+
--name="strictdoc" \
317
+
--init \
318
+
--tty \
315
319
strictdoc:latest \
316
-
/bin/bash -c "strictdoc export --formats=html"
320
+
export --formats=html ./
321
+
322
+
To run an interactive container with a shell:
323
+
324
+
.. code-block:: text
325
+
326
+
docker run \
327
+
--rm \
328
+
--volume="$(pwd):/data/" \
329
+
--user=$(id -u):$(id -g) \
330
+
--network=host \
331
+
--hostname="strictdoc" \
332
+
--name="strictdoc" \
333
+
--init \
334
+
--interactive \
335
+
--tty \
336
+
--entrypoint="" \
337
+
strictdoc:latest \
338
+
bash
317
339
318
340
.. list-table:: ``docker run`` options breakdown
319
341
:widths: 40 60
@@ -325,21 +347,27 @@ To run the container:
325
347
* - ``--rm``
326
348
- Remove container when it is exited.
327
349
328
-
* - ``HOST_UID`` and ``HOST_GID``
329
-
- These environment variables are used to tell the container that it should create a ``strictdoc`` user that has these values. This enables the content generated by the container to be visible outside the container under the permissions of the host user.
350
+
* - ``--volume="<folder on host>:/data/"``
351
+
- Normally the folder on the host should be the folder with the StrictDoc documentation. The ``/data/`` folder must always be specified without change because that's where the Docker container is designed to operate.
352
+
353
+
* - ``--user=$(id -u):$(id -g)``
354
+
- Map the host user's user and group ID to the container user's IDs. This enables the content generated by the container to be visible outside the container under the permissions of the host user.
355
+
356
+
* - ``--network=host``
357
+
- Map the host network into the container.
330
358
331
-
* - ``-v "<folder on host>:/data"``
332
-
- Normally the folder on the host should be the folder with the StrictDoc documentation. The ``/data`` folder must always be specified without change because that's where the Docker container is designed to operate.
359
+
* - ``--init``
360
+
- Forward signals.
333
361
334
-
* - ``/bin/bash -c "..."``
335
-
- This command shall typically be ``strictdoc export`` but it can also be skipped in which case the ``docker run`` will enter the container with SSH.
362
+
* - ``--entrypoint=""``
363
+
- Override entrypoint as empty to run a different command, e.g. Bash. (The default entrypoint is ``strictdoc``.)
336
364
337
-
If entering the container manually, the ``strictdoc`` command can be run as follows:
365
+
If running an interactive container with a shell, the ``strictdoc`` command can be executed as follows:
338
366
339
367
.. code-block:: text
340
368
341
-
bash-5.1# strictdoc export .
342
-
bash-5.1# exit
369
+
ubuntu@strictdoc:/data$ strictdoc export .
370
+
ubuntu@strictdoc:/data$ exit
343
371
344
372
The documentation shall be generated to ``./output/html`` which is accessible both on the host and inside the container.
0 commit comments