mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
feat(devc): add make devc shortcut to enter devcontainer from terminal
Adds scripts/devcontainer_shell.sh that detects a running devcontainer and opens an interactive shell (or runs a one-off command). Registered as `make devc` / `mise run devc`. Also consolidates README recent updates to one entry per minor series and updates the devcontainer skill with the new entry point.
This commit is contained in:
@@ -55,7 +55,18 @@ Source code is bind-mounted into the container at `/workspace`. The `ss` wrapper
|
||||
|
||||
This also applies to `go test` — tests always compile against the latest source. The Web UI backend uses `air` for hot-reload (same zero-rebuild experience).
|
||||
|
||||
## Step 0: Ensure Devcontainer is Running
|
||||
## Entering the Devcontainer
|
||||
|
||||
The quickest way to get an interactive shell inside the devcontainer:
|
||||
|
||||
```bash
|
||||
make devc # interactive bash shell
|
||||
./scripts/devcontainer_shell.sh make test # run a command directly
|
||||
```
|
||||
|
||||
The script auto-detects whether the container is running and prints setup instructions if it isn't.
|
||||
|
||||
### Programmatic access (for `docker exec` workflows)
|
||||
|
||||
```bash
|
||||
CONTAINER=$(docker compose -f .devcontainer/docker-compose.yml ps -q skillshare-devcontainer 2>/dev/null)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.PHONY: help build build-meta build-windows run test test-unit test-int test-docker test-docker-online test-redteam test-redteam-signal test-redteam-rules-signal playground playground-down dev-docker dev-docker-down docker-build docker-build-multiarch lint fmt fmt-check check install clean ui-install ui-build ui-dev build-all
|
||||
.PHONY: help build build-meta build-windows run test test-unit test-int test-docker test-docker-online test-redteam test-redteam-signal test-redteam-rules-signal playground playground-down devc dev-docker dev-docker-down docker-build docker-build-multiarch lint fmt fmt-check check install clean ui-install ui-build ui-dev build-all
|
||||
|
||||
help:
|
||||
@echo "Common tasks:"
|
||||
@@ -14,6 +14,7 @@ help:
|
||||
@echo " make test-redteam-rules-signal # verify red team test fails when critical builtin rules are disabled"
|
||||
@echo " make playground # start playground + enter shell (one step)"
|
||||
@echo " make playground-down # stop and remove playground"
|
||||
@echo " make devc # enter running devcontainer shell"
|
||||
@echo " make lint # go vet"
|
||||
@echo " make fmt # format Go files"
|
||||
@echo " make check # fmt-check + lint + test"
|
||||
@@ -72,6 +73,9 @@ playground:
|
||||
playground-down:
|
||||
./scripts/sandbox_playground_down.sh
|
||||
|
||||
devc:
|
||||
./scripts/devcontainer_shell.sh
|
||||
|
||||
dev-docker:
|
||||
docker compose -f docker-compose.sandbox.yml --profile dev watch
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
|
||||
> [!NOTE]
|
||||
> **Recent Updates**
|
||||
> - **[0.16.7](https://github.com/runkids/skillshare/releases/tag/v0.16.7)**: Dotfiles manager compatibility — sync preserves external symlinks on source and target directories (stow, chezmoi, yadm).
|
||||
> - **[0.16.*](https://github.com/runkids/skillshare/releases/tag/v0.16.6)**: Performance overhaul, interactive TUI for diff/restore/trash, file-level diff, glob matching, Homebrew-aware upgrade.
|
||||
> - **[0.16.*](https://github.com/runkids/skillshare/releases/tag/v0.16.7)**: Performance overhaul, interactive TUI for diff/restore/trash, file-level diff, glob matching, Homebrew-aware upgrade, dotfiles manager compatibility.
|
||||
> - Full history: [All Releases](https://github.com/runkids/skillshare/releases)
|
||||
|
||||
## Why skillshare
|
||||
|
||||
@@ -16,6 +16,7 @@ echo " mise run test:docker:online # docker online install/update tests"
|
||||
echo " mise run test:redteam # red team supply-chain security tests"
|
||||
echo " mise run playground # start playground + enter shell (one step)"
|
||||
echo " mise run playground:down # stop and remove playground"
|
||||
echo " mise run devc # enter running devcontainer shell"
|
||||
echo " mise run lint # go vet"
|
||||
echo " mise run fmt # format Go files"
|
||||
echo " mise run check # fmt:check + lint + test"
|
||||
@@ -85,6 +86,10 @@ run = """
|
||||
description = "Stop and remove playground container"
|
||||
run = "./scripts/sandbox_playground_down.sh"
|
||||
|
||||
[tasks.devc]
|
||||
description = "Enter running devcontainer shell"
|
||||
run = "./scripts/devcontainer_shell.sh"
|
||||
|
||||
[tasks."dev:docker"]
|
||||
description = "Go API in Docker + auto-rebuild (pair with: cd ui && pnpm run dev)"
|
||||
run = "docker compose -f docker-compose.sandbox.yml --profile dev watch"
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# Enter the running devcontainer or execute a command inside it.
|
||||
# Usage:
|
||||
# ./scripts/devcontainer_shell.sh # interactive shell
|
||||
# ./scripts/devcontainer_shell.sh make test # run a command
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
# Reuse require_docker from sandbox common, then override COMPOSE_FILE.
|
||||
source "$SCRIPT_DIR/_sandbox_common.sh"
|
||||
require_docker
|
||||
|
||||
COMPOSE_FILE="$PROJECT_ROOT/.devcontainer/docker-compose.yml"
|
||||
SERVICE="skillshare-devcontainer"
|
||||
|
||||
if [[ -z "$(docker compose -f "$COMPOSE_FILE" ps -q "$SERVICE" 2>/dev/null || true)" ]]; then
|
||||
echo "Devcontainer is not running." >&2
|
||||
echo "Start it with one of:" >&2
|
||||
echo " 1. VS Code → 'Reopen in Container'" >&2
|
||||
echo " 2. docker compose -f .devcontainer/docker-compose.yml up -d" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
docker compose -f "$COMPOSE_FILE" exec -w /workspace "$SERVICE" bash -c "$*"
|
||||
else
|
||||
docker compose -f "$COMPOSE_FILE" exec -w /workspace "$SERVICE" bash
|
||||
fi
|
||||
Reference in New Issue
Block a user