Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ reviews:
<scope> is optional
Type: chore, docs, feat, fix, refactor, style, or test.
fail_commit_status: true
request_changes_workflow: true
high_level_summary: true
high_level_summary_in_walkthrough: true
sequence_diagrams: false
suggested_reviewers: false
poem: false
Expand All @@ -18,11 +21,4 @@ reviews:
mode: off
title:
mode: off
tools:
hadolint:
enabled: true
markdownlint:
enabled: true
shellcheck:
enabled: true
language: "en-US"
1 change: 1 addition & 0 deletions .cspell/third-party-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dockerfiles
docstrings
mapfile
pipefail
shadowenv
shellcheck
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Prerequisites: Docker is available on the host, and VS Code has the `ms-vscode-r
3. Edit `projects/<your-project-name>/docker-compose.yaml` as needed.
4. Open `projects/<your-project-name>` in VS Code and run `Dev Containers: Reopen in Container`.

After the container is created, VS Code opens the workspace at `/mnt/<your-project-name>`. The data lives in a Docker volume named `<your-project-name>_workspace`.
After the container is created, VS Code opens the workspace at `/src/<your-project-name>`. The data lives in a Docker volume named `<your-project-name>_workspace`.

## Notes

Expand Down
2 changes: 1 addition & 1 deletion features/fnm/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "fnm",
"version": "1.0.0",
"name": "Fast Node Manager (fnm)",
"name": "fnm",
"description": "Installs fnm and optionally a Node.js version.",
"options": {
"nodeVersion": {
Expand Down
15 changes: 15 additions & 0 deletions features/fnm/fnm-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail

node_version="${1:?node version required (lts | <version> | none)}"

curl -fsSL https://fnm.vercel.app/install | bash

fnm_dir="$HOME/.local/share/fnm"
export PATH="$fnm_dir:$PATH"

case "$node_version" in
none) ;;
lts) fnm install --lts ;;
*) fnm install "$node_version" ;;
esac
21 changes: 7 additions & 14 deletions features/fnm/install.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
#!/usr/bin/env bash
if [ -z "${BASH_VERSION:-}" ] || [ "$(id -un)" != "$_REMOTE_USER" ]; then
exec su "$_REMOTE_USER" -c "bash -lc '$0'"
fi

set -euo pipefail

curl -fsSL https://fnm.vercel.app/install | bash

FNM_PATH="$HOME/.local/share/fnm"
export PATH="$FNM_PATH:$PATH"
FEATURE_DIR="$(cd "$(dirname "$0")" && pwd)"
FNM_SCRIPT="$FEATURE_DIR/fnm-install.sh"

NODE_VERSION="${NODE_VERSION:-lts}"
if [ "$NODE_VERSION" != "none" ]; then
if [ "$NODE_VERSION" = "lts" ]; then
fnm install --lts
else
fnm install "$NODE_VERSION"
fi

if [[ "$(id -un)" != "$_REMOTE_USER" ]]; then
su - "$_REMOTE_USER" -c "/bin/bash $(printf '%q ' "$FNM_SCRIPT" "$NODE_VERSION")"
else
/bin/bash "$FNM_SCRIPT" "$NODE_VERSION"
fi
6 changes: 6 additions & 0 deletions features/shadowenv/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "shadowenv",
"version": "1.0.0",
"name": "shadowenv",
"description": "Installs shadowenv."
}
28 changes: 28 additions & 0 deletions features/shadowenv/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail

arch="$(uname -m)"
case "$arch" in
x86_64|amd64) target="x86_64-unknown-linux-gnu" ;;
aarch64|arm64) target="aarch64-unknown-linux-gnu" ;;
*) echo "shadowenv: unsupported arch: $arch" >&2; exit 1 ;;
esac

version="3.4.0"
url="https://github.com/Shopify/shadowenv/releases/download/${version}/shadowenv-${target}"

download_path="$(mktemp)"
trap 'rm -f "$download_path"' EXIT
curl -fsSL "$url" -o "$download_path"

install_path="/usr/local/bin/shadowenv"
install -m 0755 "$download_path" "$install_path"

FEATURE_DIR="$(cd "$(dirname "$0")" && pwd)"
REGISTER_SCRIPT="$FEATURE_DIR/shadowenv-register.sh"

if [[ "$(id -un)" != "$_REMOTE_USER" ]]; then
su - "$_REMOTE_USER" -c "/bin/bash $(printf '%q' "$REGISTER_SCRIPT")"
else
/bin/bash "$REGISTER_SCRIPT"
fi
8 changes: 8 additions & 0 deletions features/shadowenv/shadowenv-register.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

line='eval "$(shadowenv init bash)"'
bashrc="$HOME/.bashrc"

touch "$bashrc"
grep -Fqx "$line" "$bashrc" || printf '\n%s\n' "$line" >> "$bashrc"
15 changes: 7 additions & 8 deletions features/uv/install.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env bash
if [ -z "${BASH_VERSION:-}" ] || [ "$(id -un)" != "$_REMOTE_USER" ]; then
exec su "$_REMOTE_USER" -c "bash -lc '$0'"
fi

set -euo pipefail

curl -fsSL https://astral.sh/uv/install.sh | sh
. "$HOME/.local/bin/env"
FEATURE_DIR="$(cd "$(dirname "$0")" && pwd)"
UV_SCRIPT="$FEATURE_DIR/uv-install.sh"

PYTHON_VERSION="${PYTHON_VERSION:-3}"
if [ "$PYTHON_VERSION" != "none" ]; then
uv python install --default "$PYTHON_VERSION"

if [[ "$(id -un)" != "$_REMOTE_USER" ]]; then
su - "$_REMOTE_USER" -c "/bin/bash $(printf '%q ' "$UV_SCRIPT" "$PYTHON_VERSION")"
else
/bin/bash "$UV_SCRIPT" "$PYTHON_VERSION"
fi
12 changes: 12 additions & 0 deletions features/uv/uv-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail

python_version="${1:?python version required (e.g. 3 | 3.12 | none)}"

curl -LsSf https://astral.sh/uv/install.sh | sh
. "$HOME/.local/bin/env"

case "$python_version" in
none) ;;
*) uv python install "$python_version" --default ;;
esac
2 changes: 1 addition & 1 deletion projects/.template/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"overrideCommand": true,
"postCreateCommand": "sudo chown $(id -un) ${containerWorkspaceFolder}",
"service": "devcontainer",
"workspaceFolder": "/mnt/${localWorkspaceFolderBasename}"
"workspaceFolder": "/src/${localWorkspaceFolderBasename}"
}
Loading