diff --git a/.devcontainer/README.md b/.devcontainer/README.md index bf276bab..9d10ccd4 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -19,6 +19,7 @@ It works on Linux, Windows and OSX. 1. Open the command palette in Visual Studio Code (CTRL+SHIFT+P). 1. Select `Remote-Containers: Open Folder in Container...` and choose the project directory. +1. For Docker running on Windows HyperV, if you want to use SSH keys, bind mount them at `/tmp/.ssh` by changing the `volumes` section in the [docker-compose.yml](docker-compose.yml). ## Customization diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 69ddf0ff..ce0b7e06 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,7 +8,7 @@ "vscode" ], "shutdownAction": "stopCompose", - "postCreateCommand": "go mod download", + "postCreateCommand": "source ~/.windows.sh && go mod download && go mod tidy", "workspaceFolder": "/workspace", "extensions": [ "golang.go", diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 66b41a09..feb7cd92 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -8,12 +8,17 @@ services: - ../:/workspace # Docker socket to access Docker server - /var/run/docker.sock:/var/run/docker.sock - # SSH directory - - ~/.ssh:/home/vscode/.ssh - - ~/.ssh:/root/.ssh + # Docker configuration + - ~/.docker:/root/.docker:z + # SSH directory for Linux, OSX and WSL + - ~/.ssh:/root/.ssh:z + # For Windows without WSL, a copy will be made + # from /tmp/.ssh to ~/.ssh to fix permissions + #- ~/.ssh:/tmp/.ssh:ro + # Shell history persistence + - ~/.zsh_history:/root/.zsh_history:z # Git config - - ~/.gitconfig:/home/districter/.gitconfig - - ~/.gitconfig:/root/.gitconfig + - ~/.gitconfig:/root/.gitconfig:z environment: - TZ= cap_add: