From 1e0e5b2df06b0862fe3aef6351f21385b28e9e11 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 5 Jun 2025 09:59:04 +0200 Subject: [PATCH 1/2] Instructions to run the devcontainer locally --- getting-started/setup-building.rst | 40 +++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index efa3cf31d..8da6e99cd 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -1186,7 +1186,45 @@ select the option ``Open in VS Code``. You will still be working on the remote codespace instance, thus using the remote instance's compute power. The compute power may be a much higher spec than your local machine which can be helpful. -.. TODO: add docker instructions + +Building the container locally +------------------------------ + +If you want more control over the environment, or to work offline, +you can build the container locally. +This is meant for users who have (or want to get) some experience +with containers. +The following instructions are a starting point for +your own customizations. +They assume a Unix-like environment, and Docker or Podman installed. + +In a clone of the `cpython-devcontainers repo `_, +build the container and name it ``cpython-dev``: + +.. code-block:: bash + + docker build devcontainer/ --tag cpython-dev + +(Substitute ``podman`` for ``docker`` if you use Podman.) + +The same command will update any existing ``cpython-dev`` container. +Run it again from time to time -- especially if the container stops +working for you. + +To run the container, run one of the following commands in a clone of the +CPython repository. + +.. code-block:: bash + + docker run -it --rm --volume $PWD:/workspace --workdir /workspace cpython-dev + +.. code-block:: bash + + podman run -it --rm --volume $PWD:/workspace:Z --workdir /workspace cpython-dev + +Note that the container has read/write access to the working directory. +You may want to use a separate clone of CPython, or run ``git clean -fxd`` +to remove caches and build output generated for your host OS. .. c_codespaces_end From 6940956b97a095f9941feec34da8b0a122d9b73b Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 6 Jun 2025 10:02:30 +0200 Subject: [PATCH 2/2] Apply suggestions from code review --- getting-started/setup-building.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 8da6e99cd..aa783f24e 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -1223,7 +1223,7 @@ CPython repository. podman run -it --rm --volume $PWD:/workspace:Z --workdir /workspace cpython-dev Note that the container has read/write access to the working directory. -You may want to use a separate clone of CPython, or run ``git clean -fxd`` +You may want to use a separate clone of CPython, or run ``make clean`` to remove caches and build output generated for your host OS. .. c_codespaces_end