Skip to content

Commit c7ff702

Browse files
committed
feat: update Justfile for improved architecture detection and add new installation recipes
Signed-off-by: Aaron Wislang <aaron.wislang@microsoft.com>
1 parent 4c40eb2 commit c7ff702

File tree

2 files changed

+472
-8
lines changed

2 files changed

+472
-8
lines changed

.devcontainer/just/Justfile

Lines changed: 124 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
set shell := ["bash", "-uc"]
22

3-
arch := `dpkg --print-architecture`
3+
arch := `uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/'`
44
GO_VERSION := env_var_or_default("GO_VERSION", "1.25.1")
55
TARGETARCH := env_var_or_default("TARGETARCH", arch)
66
IMAGE := env_var_or_default("JUST_IMAGE", "just-dev:latest")
77
CONTAINER_CMD := env_var_or_default("JUST_CONTAINER_CMD", "bash")
88
WASSETTE_REF := env_var_or_default("WASSETTE_REF", "main")
99
WASSETTE_REF_TYPE := env_var_or_default("WASSETTE_REF_TYPE", "branch")
10+
PORT := env_var_or_default("PORT", "8080")
1011

1112
export CARGO_HOME := "/home/vscode/.cargo"
1213
export RUSTUP_HOME := "/home/vscode/.rustup"
@@ -18,6 +19,37 @@ alias default := list
1819
list:
1920
just --list
2021

22+
run-sequential *recipes:
23+
#!/usr/bin/env bash
24+
set -euxo pipefail
25+
for recipe in {{recipes}}; do
26+
echo "Running recipe: $recipe"
27+
just "$recipe"
28+
done
29+
30+
setup-completions:
31+
#!/usr/bin/env bash
32+
set -euxo pipefail
33+
# Setup bash completion
34+
mkdir -p /etc/bash_completion.d
35+
just --completions bash > /etc/bash_completion.d/just
36+
# Setup zsh completion for vscode user
37+
mkdir -p /home/vscode/.zsh/completion
38+
just --completions zsh > /home/vscode/.zsh/completion/_just
39+
chown -R vscode:vscode /home/vscode/.zsh
40+
# Add to vscode's .zshrc if not already there
41+
if [ -f /home/vscode/.zshrc ]; then
42+
if ! grep -q "fpath=(.*\.zsh/completion" /home/vscode/.zshrc; then
43+
echo 'fpath=(~/.zsh/completion $fpath)' >> /home/vscode/.zshrc
44+
echo 'autoload -Uz compinit && compinit' >> /home/vscode/.zshrc
45+
fi
46+
else
47+
echo 'fpath=(~/.zsh/completion $fpath)' > /home/vscode/.zshrc
48+
echo 'autoload -Uz compinit && compinit' >> /home/vscode/.zshrc
49+
chown vscode:vscode /home/vscode/.zshrc
50+
fi
51+
echo "Completions installed. Restart your shell or run: source ~/.bashrc (or ~/.zshrc)"
52+
2153
install-go:
2254
#!/usr/bin/env bash
2355
set -euxo pipefail
@@ -55,7 +87,42 @@ install-node:
5587
node --version
5688
npm --version
5789

58-
configure-npm-prefix:
90+
install-java:
91+
#!/usr/bin/env bash
92+
set -euxo pipefail
93+
apt-get update
94+
apt-get install -y --no-install-recommends openjdk-21-jdk
95+
rm -rf /var/lib/apt/lists/*
96+
java -version
97+
javac -version
98+
99+
install-maven: install-java
100+
#!/usr/bin/env bash
101+
set -euxo pipefail
102+
MAVEN_VERSION="3.9.9"
103+
apt-get update
104+
apt-get install -y --no-install-recommends wget tar
105+
rm -rf /var/lib/apt/lists/*
106+
wget -q -O /tmp/maven.tar.gz "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz"
107+
tar -C /opt -xzf /tmp/maven.tar.gz
108+
ln -sf "/opt/apache-maven-${MAVEN_VERSION}/bin/mvn" /usr/local/bin/mvn
109+
rm /tmp/maven.tar.gz
110+
mvn --version
111+
112+
install-gradle: install-java
113+
#!/usr/bin/env bash
114+
set -euxo pipefail
115+
GRADLE_VERSION="8.11.1"
116+
apt-get update
117+
apt-get install -y --no-install-recommends wget unzip
118+
rm -rf /var/lib/apt/lists/*
119+
wget -q -O /tmp/gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip"
120+
unzip -q /tmp/gradle.zip -d /opt
121+
ln -sf "/opt/gradle-${GRADLE_VERSION}/bin/gradle" /usr/local/bin/gradle
122+
rm /tmp/gradle.zip
123+
gradle --version
124+
125+
configure-npm-prefix: install-node
59126
#!/usr/bin/env bash
60127
set -euxo pipefail
61128
mkdir -p /home/vscode/.npm-global
@@ -92,11 +159,17 @@ install-homebrew:
92159
apt-get install -y --no-install-recommends build-essential procps curl file git
93160
rm -rf /var/lib/apt/lists/*
94161
{{vscode}} bash -lc 'if [ ! -d /home/linuxbrew/.linuxbrew ]; then NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; fi'
95-
{{vscode}} bash -lc 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew update && brew install codex sst/tap/opencode'
162+
{{vscode}} bash -lc 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew update'
96163
printf 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"\n' > /etc/profile.d/homebrew.sh
97164
{{vscode}} bash -lc 'if ! grep -q "brew shellenv" ~/.bashrc; then echo "eval \"$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)\"" >> ~/.bashrc; fi'
98165

99-
install-cli-npm: configure-npm-prefix install-node
166+
install-brew-codex: install-homebrew
167+
{{vscode}} bash -lc 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew install codex'
168+
169+
install-brew-opencode: install-homebrew
170+
{{vscode}} bash -lc 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && brew install sst/tap/opencode'
171+
172+
install-cli-npm: configure-npm-prefix
100173
{{vscode}} bash -lc 'npm install -g @anthropic-ai/claude-code @google/gemini-cli @charmland/crush @github/copilot'
101174

102175
install-llm:
@@ -108,7 +181,18 @@ install-llm:
108181
python3 -m venv /opt/llm-env
109182
chown -R vscode:vscode /opt/llm-env
110183
{{vscode}} bash -lc '/opt/llm-env/bin/pip install --upgrade pip'
111-
{{vscode}} bash -lc '/opt/llm-env/bin/pip install llm llm-gpt4all llm-claude-3 llm-gemini llm-ollama llm-foundry'
184+
{{vscode}} bash -lc '/opt/llm-env/bin/pip install llm'
185+
186+
install-llm-plugins: install-llm
187+
#!/usr/bin/env bash
188+
set -euxo pipefail
189+
{{vscode}} bash -lc '/opt/llm-env/bin/pip install llm-claude-3 llm-gemini llm-ollama llm-foundry'
190+
191+
install-llm-gpt4all: install-llm
192+
#!/usr/bin/env bash
193+
set -euxo pipefail
194+
# Note: gpt4all may have shared library dependencies issues on some systems
195+
{{vscode}} bash -lc '/opt/llm-env/bin/pip install llm-gpt4all'
112196

113197
install-wassette:
114198
#!/usr/bin/env bash
@@ -124,11 +208,43 @@ link-wassette: install-wassette
124208
ln -sf /home/vscode/.cargo/bin/wassette /usr/local/bin/wassette
125209
ls -la /usr/local/bin/wassette
126210

127-
install-all: install-go install-rust install-node configure-npm-prefix install-azure-cli install-github-cli install-homebrew install-cli-npm install-llm install-wassette link-wassette
211+
install-all: install-go install-rust install-node install-java install-maven install-gradle configure-npm-prefix install-azure-cli install-github-cli install-homebrew install-brew-codex install-brew-opencode install-cli-npm install-llm install-llm-plugins install-wassette link-wassette
128212
@echo "All components installed"
129213

214+
build-docker:
215+
docker build -t {{IMAGE}} --build-arg TARGETARCH={{TARGETARCH}} --build-arg GO_VERSION={{GO_VERSION}} .
216+
217+
build-docker-all:
218+
#!/usr/bin/env bash
219+
set -euxo pipefail
220+
IMAGE_BASE="$(echo {{IMAGE}} | cut -d: -f1)"
221+
docker build -t "${IMAGE_BASE}:all" --build-arg TARGETARCH={{TARGETARCH}} --build-arg GO_VERSION={{GO_VERSION}} --build-arg INSTALL_ALL=true .
222+
223+
build-macos-container:
224+
#!/usr/bin/env bash
225+
set -euxo pipefail
226+
container system start || true
227+
container build -t {{IMAGE}} --build-arg TARGETARCH={{TARGETARCH}} --build-arg GO_VERSION={{GO_VERSION}} .
228+
229+
build-macos-container-all:
230+
#!/usr/bin/env bash
231+
set -euxo pipefail
232+
container system start || true
233+
IMAGE_BASE="$(echo {{IMAGE}} | cut -d: -f1)"
234+
container build -t "${IMAGE_BASE}:all" --build-arg TARGETARCH={{TARGETARCH}} --build-arg GO_VERSION={{GO_VERSION}} --build-arg INSTALL_ALL=true .
235+
236+
stop-containers:
237+
#!/usr/bin/env bash
238+
set -eux
239+
# Stop all running containers based on the image
240+
container ps -q -f ancestor={{IMAGE}} | xargs -r container stop || true
241+
docker ps -q -f ancestor={{IMAGE}} | xargs -r docker stop || true
242+
130243
run-docker:
131-
docker run --rm -it -p 8080:8080 -v "$(pwd)":/pwd -w /pwd {{IMAGE}} {{CONTAINER_CMD}}
244+
docker run --rm -it -p {{PORT}}:8080 -v "$(pwd)":/pwd -w /pwd {{IMAGE}} {{CONTAINER_CMD}}
132245

133246
run-macos-container:
134-
container run --rm --publish 8080:8080 --volume "$(pwd)":/pwd --workdir /pwd {{IMAGE}} {{CONTAINER_CMD}}
247+
#!/usr/bin/env bash
248+
set -euxo pipefail
249+
container system start || true
250+
container run --rm -it --publish {{PORT}}:8080 --volume "$(pwd)":/pwd --workdir /pwd {{IMAGE}} {{CONTAINER_CMD}}

0 commit comments

Comments
 (0)