Created
February 8, 2024 19:05
-
-
Save bketelsen/188fb522896e38e62979d5a44a6b47f8 to your computer and use it in GitHub Desktop.
install "features" intended for devcontainers locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
built this for my incus containers as a quick way to provision some dev tools. Why reinvent the wheel?!
usage
feature.sh go