Skip to content

Commit 26f2842

Browse files
committed
Persist devcontainer command history
1 parent 1171539 commit 26f2842

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

.devcontainer/devcontainer.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55

66
"image": "ghcr.io/object-object/mlogv32-devcontainer:latest",
77

8-
"mounts": ["type=volume,target=/workspaces/mlogv32/.venv"],
8+
"mounts": [
9+
"type=volume,target=/workspaces/mlogv32/.venv",
10+
"type=volume,target=/commandhistory"
11+
],
912

10-
"postAttachCommand": ".devcontainer/postAttachCommand.sh",
13+
"postAttachCommand": {
14+
"Fix workspaces permissions": "sudo chown -R vscode /workspaces",
15+
"Fix commandhistory permissions": "sudo chown -R vscode: /commandhistory",
16+
"uv sync": "uv sync"
17+
},
1118

1219
"customizations": {
1320
"vscode": {

.devcontainer/postAttachCommand.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/.devcontainer/Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@ COPY --from=ghcr.io/object-object/mlogv32-riscv-gnu-toolchain:rv32ima-ilp32 /opt
88

99
COPY --from=registry.gitlab.com/incoresemi/docker-images/compliance /usr/bin/riscv_sim_RV32 /opt/sail-riscv/
1010

11+
# https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history
12+
ARG USERNAME=vscode
13+
14+
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
15+
&& mkdir /commandhistory \
16+
&& touch /commandhistory/.bash_history \
17+
&& chown -R $USERNAME /commandhistory \
18+
&& echo "$SNIPPET" >> "/home/$USERNAME/.bashrc"
19+
1120
# avoid permission issues with cargo if cargo install runs as root
12-
USER vscode
21+
USER ${USERNAME}
1322

1423
RUN rustup toolchain install nightly-2024-11-16
1524

0 commit comments

Comments
 (0)