Skip to content

Commit 33e2eb9

Browse files
rtfisherclaude
andcommitted
Add GitHub Codespaces support with dev container and CI test
Add .devcontainer/devcontainer.json to enable Codespaces with the existing flashx_dockerfile. Detect Codespaces in run_flashx.sh to skip Docker build/run when the environment is already provisioned. Add a devcontainers/ci job to the CI workflow to validate the dev container builds correctly. Update README with browser and CLI usage instructions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 551de9d commit 33e2eb9

5 files changed

Lines changed: 82 additions & 2 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Flash-X Development Environment",
3+
"dockerFile": "../flashx_dockerfile",
4+
"build": {
5+
"args": {
6+
"USER_ID": "1000",
7+
"GROUP_ID": "1000"
8+
}
9+
},
10+
"remoteUser": "flashuser",
11+
"postStartCommand": "echo 'Flash-X environment ready. Run cd ~/flashx/Flash-X/object && ./flashx to execute the Sedov test.'"
12+
}

.github/workflows/ci.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,23 @@ jobs:
124124
run: |
125125
docker run --rm flashx:test bash -c "cd /home/flashuser/flashx/Flash-X/object && ./flashx"
126126
127+
devcontainer-build:
128+
name: Dev Container Build Test
129+
runs-on: ubuntu-latest
130+
131+
steps:
132+
- name: Checkout code
133+
uses: actions/checkout@v4
134+
135+
- name: Build dev container
136+
uses: devcontainers/ci@v0.3
137+
with:
138+
runCmd: |
139+
echo "Dev container built successfully"
140+
whoami
141+
test -f /home/flashuser/flashx/Flash-X/object/flashx
142+
echo "Flash-X executable found"
143+
127144
security-scan:
128145
name: Security Scan
129146
runs-on: ubuntu-latest
@@ -150,7 +167,7 @@ jobs:
150167
validation-summary:
151168
name: Validation Summary
152169
runs-on: ubuntu-latest
153-
needs: [lint-shell, lint-dockerfile, test-shell-script, test-dockerfile, test-integration, docker-build-and-run]
170+
needs: [lint-shell, lint-dockerfile, test-shell-script, test-dockerfile, test-integration, docker-build-and-run, devcontainer-build]
154171
if: always()
155172

156173
steps:
@@ -162,6 +179,7 @@ jobs:
162179
echo "Test Dockerfile: ${{ needs.test-dockerfile.result }}"
163180
echo "Integration Tests: ${{ needs.test-integration.result }}"
164181
echo "Docker Build and Run: ${{ needs.docker-build-and-run.result }}"
182+
echo "Dev Container Build: ${{ needs.devcontainer-build.result }}"
165183
166184
if [ "${{ needs.lint-shell.result }}" != "success" ] || \
167185
[ "${{ needs.lint-dockerfile.result }}" != "success" ] || \

CLAUDE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ tests/
1414
test_run_flashx.bats # Unit tests for the launcher script
1515
test_docker_build.bats # Dockerfile validation tests
1616
test_integration.bats # End-to-end integration tests
17+
.devcontainer/
18+
devcontainer.json # GitHub Codespaces / Dev Container config
1719
.github/workflows/ci.yml # CI pipeline
1820
```
1921

@@ -49,4 +51,5 @@ Integration tests that require a built Docker image are skipped by default (they
4951
- Container runs as non-root user `flashuser` with host UID/GID mapping; hostname is `flashx`
5052
- Volume mount: `~/flashx` on host maps to `/home/flashuser/flashx/Flash-X/desktop` in container
5153
- BATS tests use `@test "description" { ... }` with descriptive imperative names
52-
- Cross-platform support: Linux, macOS, Windows (WSL2) with `uname -s` detection
54+
- Cross-platform support: Linux, macOS, Windows (WSL2), and GitHub Codespaces
55+
- `run_flashx.sh` detects Codespaces (`CODESPACES=true`) and skips Docker build/run

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,44 @@ This will:
5858
/home/flashuser/flashx/Flash-X/desktop
5959
```
6060

61+
### GitHub Codespaces (no local Docker required)
62+
63+
You can run Flash-X entirely in the cloud using GitHub Codespaces. The repository includes a dev container configuration, so the Codespace is automatically built with all dependencies.
64+
65+
**From the browser:**
66+
67+
1. Navigate to [https://github.com/rtfisher/flashx_docker](https://github.com/rtfisher/flashx_docker)
68+
2. Click the green **Code** button, then select the **Codespaces** tab
69+
3. Click **Create codespace on main**
70+
4. Once the environment loads, open a terminal and run:
71+
72+
```bash
73+
cd ~/flashx/Flash-X/object
74+
./flashx
75+
```
76+
77+
**From the command line (GitHub CLI):**
78+
79+
```bash
80+
# Create a codespace
81+
gh codespace create -r rtfisher/flashx_docker -b main
82+
83+
# SSH in — pure terminal, no VS Code
84+
gh codespace ssh -c <codespace-name>
85+
86+
# Once inside, the Flash-X environment is ready:
87+
cd ~/flashx/Flash-X/object
88+
./flashx
89+
```
90+
91+
You can also forward ports back to your local machine if needed:
92+
93+
```bash
94+
gh codespace ports forward 8000:8000 -c <codespace-name>
95+
```
96+
97+
> If you run `./run_flashx.sh` inside a Codespace, it will detect the environment and drop you into the object directory directly, skipping the Docker build.
98+
6199
## Directory Structure
62100

63101
```

run_flashx.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121

2222
set -e # Exit immediately on error
2323

24+
# If running inside a GitHub Codespace, the environment is already set up
25+
# via devcontainer.json — no Docker build/run needed.
26+
if [ "${CODESPACES}" = "true" ]; then
27+
echo "Running inside GitHub Codespaces — Docker container not needed."
28+
echo "The Flash-X environment is already available."
29+
cd "${HOME}/flashx/Flash-X/object"
30+
exec /bin/bash
31+
fi
32+
2433
# Check if Docker is running
2534
if ! docker info > /dev/null 2>&1; then
2635
echo "Docker is not running. Please start Docker and try again."

0 commit comments

Comments
 (0)