Skip to content

Commit

Permalink
Create test.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr committed Aug 16, 2023
1 parent 64468b5 commit 1ade30e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -ex
[[ -n $1 ]] && image=$1 || image='mcr.microsoft.com/devcontainers/base:debian'
[[ -n $2 ]] && options=$2 || options='{}'
feature_dir=$PWD
temp_dir=$(mktemp -d)
trap 'rm -rf "$temp_dir"' SIGINT SIGTERM ERR EXIT
pushd "$temp_dir"
mkdir -p .devcontainer
cat <<EOF | tee .devcontainer/devcontainer.json
{
"image": "$image",
"features": {
"./feature": $options
}
}
EOF
rsync -av --exclude .git "$feature_dir/" "$PWD/.devcontainer/feature/"
tree -a
container_id=$(devcontainer up --workspace-folder . | jq -r .containerId)
devcontainer exec --workspace-folder . clang --version
docker kill "$container_id"

0 comments on commit 1ade30e

Please sign in to comment.