Skip to content

Instantly share code, notes, and snippets.

@bketelsen
Created February 8, 2024 19:05
Show Gist options
  • Save bketelsen/188fb522896e38e62979d5a44a6b47f8 to your computer and use it in GitHub Desktop.
Save bketelsen/188fb522896e38e62979d5a44a6b47f8 to your computer and use it in GitHub Desktop.
install "features" intended for devcontainers locally
#!/bin/bash
# install a "feature" from the devcontainers/features repo outside of a container
# requires git, jq
# for this to work well, you should already have a user with uid/gid 1000
FEATUREROOT="${FEATUREROOT:-"/opt/features"}"
FEATUREREPO="${FEATUREREPO:-"https://github.com/devcontainers/features"}"
echo $FEATUREROOT
echo $FEATUREREPO
FEATURE=$1
git clone "${FEATUREREPO}" "${FEATUREROOT}"
cd "${FEATUREROOT}"
./src/common-utils/install.sh
./src/"${FEATURE}"/install.sh
jq -r '.containerEnv | keys[] as $k | "export \($k)=\(.[$k])"' ./src/"${FEATURE}"/devcontainer-feature.json > /etc/profile.d/99-"${FEATURE}".sh
@bketelsen
Copy link
Author

built this for my incus containers as a quick way to provision some dev tools. Why reinvent the wheel?!

usage feature.sh go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment