diff --git a/doc/source/development/contributing_environment.rst b/doc/source/development/contributing_environment.rst index bc0a3556b9ac1..c04ce33649345 100644 --- a/doc/source/development/contributing_environment.rst +++ b/doc/source/development/contributing_environment.rst @@ -24,7 +24,15 @@ Instead of manually setting up a development environment, you can use `Docker commands. pandas provides a ``DockerFile`` in the root directory to build a Docker image with a full pandas development environment. -**Docker Commands** +**Unix/macOS** + +There is a script to help you with this:: + + ./scripts/docker.sh + +When prompted, enter your Github username. + +**Windows** Pass your GitHub username in the ``DockerFile`` to use your own fork:: diff --git a/scripts/docker.sh b/scripts/docker.sh new file mode 100755 index 0000000000000..ea572cc717efb --- /dev/null +++ b/scripts/docker.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Set up a development environment with Docker. + +run_container () { + # Run a container and bind the local forked repo to it + docker run -it --rm -v "$(pwd)":/home/pandas-"$USER" pandas-"$USER"-env +} + +# Check if pandas image already exists +docker image ls | grep "pandas-$USER-env" &> /dev/null + +if [[ $? == 0 ]]; then + + run_container + +else + + # Pass the Github username as the build variable + read -rp "Github username: " gh_username + docker build --tag pandas-"$USER"-env --build-arg gh_username=$gh_username . + + run_container + +fi