0

I write my notes by vscode's devcontainer, it's sphinx. So I want add sphinx-autobuild to auto build my notes when any .rst file changed.

This cmd is sphinx-autobuild /workspaces/notes /workspaces/notes/_build/html/.

I append CMD sphinx-autobuild /workspaces/notes /workspaces/notes/_build/html/ in Dockerfile, it does not work clearly.

How do I run this cmd automatly after devcontainer was opened?

1 Answers1

1

Finally, I find the answer.

According to devcontainerjson-reference, postCreateCommand, postStartCommand and postAttachCommand can be used to run a command when a container be created or be started or be attached.

So, to run sphinx-autobuild after vscode opened, just append

"postAttachCommand": "sphinx-autobuild /workspaces/notes/ /workspaces/notes/_build/html/",

to devcontainer.json.

postAttachCommand be a type of string or array.