Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created September 16, 2021 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save metaskills/f57fe57b87b8e60c4f4210391f370ebd to your computer and use it in GitHub Desktop.
Save metaskills/f57fe57b87b8e60c4f4210391f370ebd to your computer and use it in GitHub Desktop.
Custom Ink Common Strap Codespaces Examples
{
"dockerFile": "Dockerfile",
"runArgs": ["--init", "--privileged"],
"mounts": ["source=dind-var-lib-docker,target=/var/lib/docker,type=volume"],
"remoteUser": "root",
"postCreateCommand": "./.devcontainer/postCreate",
"postAttachCommand": "./.devcontainer/postAttach"
}
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:14
VOLUME [ "/var/lib/docker" ]
#!/bin/sh
set -e
rm -rf /workspaces/.strap-codespaces
git clone "https://${GITHUB_TOKEN}@github.com/myorg/strap-codespaces.git" /workspaces/.strap-codespaces
cd /workspaces/.strap-codespaces
./postCreate.sh
#!/bin/sh
set -e
if ! [ -x "$(command -v docker)" ]; then
echo "== [Custom Ink Strap Codespaces] installing 'docker' and 'docker-compose'... =="
URL="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/docker-in-docker-debian.sh"
curl -s $URL | sudo bash /dev/stdin 1> /dev/null
fi
#!/bin/sh
set -e
echo "== [Custom Ink Strap Codespaces] installing 'ssh-agent' script... =="
AGENT_SCRIPT=$(cat ./create-ssh-agent-script)
echo "$AGENT_SCRIPT" >> $HOME/.zshrc
echo "$AGENT_SCRIPT" >> $HOME/.bashrc
echo "== [Custom Ink Strap Codespaces] installing 'ssh-add' script... =="
ADD_SCRIPT=$(cat ./create-ssh-add-script)
echo "$ADD_SCRIPT" >> $HOME/.zshrc
echo "$ADD_SCRIPT" >> $HOME/.bashrc
#!/bin/sh
set -e
echo "== [Custom Ink Strap Codespaces] (postAttach)... =="
# Docker
./start-docker.sh
echo "== [Custom Ink Strap Codespaces] (postAttach) complete! =="
#!/bin/sh
set -e
echo "== [Custom Ink Strap Codespaces] (postCreate) ... =="
# AWS
./create-aws-cli.sh
./create-aws-credentials.sh
# Docker
./create-docker.sh
# SSH
./create-ssh-known-hosts.sh
./create-ssh-starters.sh
echo "== [Custom Ink Strap Codespaces] (postCreate) complete! =="
#!/bin/sh
set -e
echo "== [Custom Ink Strap Codespaces] starting docker daemon if not already... =="
if [ -f "/usr/local/share/docker-init.sh" ]; then
if ! pgrep -f dockerd > /dev/null 2>&1; then
nohup bash -c "/usr/local/share/docker-init.sh &" </dev/null >/dev/null 2>&1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment