Skip to content

Commit

Permalink
Setup remote container and Codespaces configuration (#17)
Browse files Browse the repository at this point in the history
* Add vanilla Debian devcontainer config files

Based on:
https://github.com/microsoft/vscode-dev-containers/blob/master/containers/debian/.devcontainer

* Set Zsh as default container terminal

Zsh is already installed, so this was just a case of changing the VS
Code configuration setting.

* Use dark colour theme on remote containers

* Install shellcheck extension on remote containers

* Add docker extension on remote containers

* Add yaml extension on remote containers

* Add commented out devcontainer postCreateCommand

Added it so it's there for reference.

* Fix editor problem for git commit messages

We now check for either `code` or `code-insiders` to be the editor.

* Enable VS Code commit signing flag

All this flag does is to add `-S` when calling git commit[1] from within
VS Code.

[1] microsoft/vscode#97300 (comment)
  • Loading branch information
johnboyes authored Jul 31, 2020
1 parent 3da6abe commit b5bfe53
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Based on the example Dockerfile at:
# https://github.com/microsoft/vscode-dev-containers/blob/master/containers/debian/.devcontainer/Dockerfile

# Update the VARIANT arg in devcontainer.json to pick an Debian version: buster (or debian-10), stretch (or debian-9)
ARG VARIANT=buster
FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT}

# Configure VSCode as the default editor for git commits
# Adapted from https://github.com/microsoft/vscode-dev-containers/blob/master/containers/codespaces-linux/.devcontainer/Dockerfile
ARG GIT_EDITOR_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/containers/codespaces-linux/.devcontainer/git-ed.sh"
RUN mkdir -p /tmp/git-ed \
&& curl -sSL ${GIT_EDITOR_SCRIPT_SOURCE} -o /tmp/git-ed/git-ed.sh \
&& install -m 755 /tmp/git-ed/git-ed.sh /usr/local/bin/git-ed.sh \
&& git config --global core.editor "/usr/local/bin/git-ed.sh" \
# Clean up
&& rm -rf /tmp/git-ed
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "Docker Container GitHub Action development",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/zsh",
"workbench.colorTheme": "Default Dark+",
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"timonwong.shellcheck",
"ms-azuretools.vscode-docker",
"redhat.vscode-yaml"
]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"git.enableCommitSigning": true,

}

0 comments on commit b5bfe53

Please sign in to comment.