From 0035d7d9e1ddd9394acbb119caa528bfb09e6e3e Mon Sep 17 00:00:00 2001 From: Jacob Phillips Date: Mon, 26 Feb 2024 20:00:51 +0000 Subject: [PATCH] install dotfiles after the devcontainer is created --- .devcontainer/Dockerfile | 1 - .devcontainer/devcontainer.json | 8 +++++--- .devcontainer/docker-compose.yml | 4 +++- .devcontainer/post-create.sh | 8 ++++++++ .gitignore | 1 + 5 files changed, 17 insertions(+), 5 deletions(-) delete mode 100644 .devcontainer/Dockerfile create mode 100755 .devcontainer/post-create.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 8ec05c1..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -FROM mcr.microsoft.com/devcontainers/rust:bookworm diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 21259e7..a2844f9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,14 +3,16 @@ "dockerComposeFile": "./docker-compose.yml", "service": "app", "workspaceFolder": "/cypher-dto", - "postCreateCommand": "sudo chown -R vscode:vscode /cypher-dto", + "postCreateCommand": ".devcontainer/post-create.sh", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {} + }, "customizations": { "vscode": { "extensions": [ "rust-lang.rust-analyzer", "JScearcy.rust-doc-viewer", - "tamasfe.even-better-toml", - "vadimcn.vscode-lldb" + "tamasfe.even-better-toml" ] } } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 3f0c93b..5388df9 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -4,12 +4,14 @@ services: app: build: context: .. - dockerfile: .devcontainer/Dockerfile + image: mcr.microsoft.com/devcontainers/rust:bookworm depends_on: - db command: sleep infinity volumes: - ..:/cypher-dto:cached + environment: + GITHUB_TOKEN: ${GITHUB_TOKEN} db: image: neo4j:5 diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 0000000..52a5b67 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,8 @@ +# Ensure devcontainer user owns the project directory +sudo chown -R vscode:vscode /cypher-dto + +# Remember history on the local machine +ln -s /cypher-dto/.devcontainer/.bash_history ~/.bash_history + +# Install dotfiles +gh repo clone dotfiles ~/dotfiles && ~/dotfiles/install.sh diff --git a/.gitignore b/.gitignore index 2f7896d..d4a1f50 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ target/ +.bash_history