From f9f08c8aa100ad2450bbc0579bef7e4aff95c6f1 Mon Sep 17 00:00:00 2001 From: Nils Dijk Date: Tue, 26 Sep 2023 22:24:28 +0200 Subject: [PATCH] persist bash history --- .devcontainer/Dockerfile | 8 ++++++++ .devcontainer/devcontainer.json | 1 + 2 files changed, 9 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ff96e1a2a3d..7fbff171af0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -156,6 +156,14 @@ COPY --chown=root:root .gdbinit /root/ RUN mkdir .bin ENV PATH="/home/citus/.bin:${PATH}" +# for persistent bash history across devcontainers we need to have +# a) a directory to store the history in +# b) a prompt command to append the history to the file +# c) specify the history file to store the history in +# b and c are done in the .bashrc to make it persistent across shells only +RUN sudo install -d -o citus -g citus /commandhistory \ + && echo "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" >> "/home/citus/.bashrc" + # install citus-dev RUN git clone --branch develop https://github.com/citusdata/tools.git citus-tools \ && ( cd citus-tools/citus_dev && pipenv install ) \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c300690b4b8..f752c7ee06f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,6 +25,7 @@ }, "mounts": [ "type=volume,target=/data", + "source=citus-bashhistory,target=/commandhistory,type=volume", ], "updateContentCommand": "./configure", "postCreateCommand": "make -C .devcontainer/",