Skip to content

Commit 2a672dd

Browse files
committed
feat: container-only mode with Go pre-installed (no fallback)
- Container mode is always ON (like herm), --no-container to opt out - Image includes Go 1.26.1, Python 3, Node.js, git, ripgrep, make, gcc - No fallback to host — if Docker is not running, shows clear error - DevEnv tool available for agent to extend environment on-the-fly
1 parent de42d98 commit 2a672dd

2 files changed

Lines changed: 27 additions & 29 deletions

File tree

cmd/container_boot.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,19 @@ type containerStatusMsg struct {
2626
// It writes the Dockerfile to a temp dir and runs docker build.
2727
func buildHawkImage(ctx context.Context, tag string) bool {
2828
dockerfile := `FROM ubuntu:24.04
29+
ENV DEBIAN_FRONTEND=noninteractive
2930
RUN apt-get update && apt-get install -y --no-install-recommends \
30-
git curl wget jq tree ripgrep fd-find make gcc \
31-
python3 python3-pip nodejs npm ca-certificates openssh-client \
31+
git curl wget jq tree ripgrep fd-find make gcc g++ \
32+
python3 python3-pip python3-venv \
33+
nodejs npm \
34+
ca-certificates openssh-client unzip xz-utils \
3235
&& rm -rf /var/lib/apt/lists/* \
3336
&& ln -sf /usr/bin/fdfind /usr/bin/fd
37+
# Install Go
38+
RUN curl -fsSL https://go.dev/dl/go1.26.1.linux-$(dpkg --print-architecture).tar.gz | tar -C /usr/local -xz
39+
ENV PATH="/usr/local/go/bin:${PATH}"
40+
ENV GOPATH="/root/go"
41+
ENV PATH="${GOPATH}/bin:${PATH}"
3442
ENV TERM=xterm-256color LANG=C.UTF-8
3543
`
3644
// Use platform-appropriate arch
@@ -57,16 +65,13 @@ ENV TERM=xterm-256color LANG=C.UTF-8
5765
}
5866

5967
// shouldUseContainer determines if hawk should run in container mode.
60-
// Default: YES if Docker is available (like herm). User can override with --no-container.
68+
// Default: ALWAYS (like herm). Container-first, no fallback.
69+
// User can opt out with --no-container for host mode.
6170
func shouldUseContainer() bool {
6271
if noContainer {
6372
return false
6473
}
65-
if containerMode {
66-
return true
67-
}
68-
// Default: auto-detect. If Docker is running, use container mode.
69-
return sandbox.DockerAvailable()
74+
return true
7075
}
7176

7277
// bootContainerCmd starts the container in the background and sends status

container/Dockerfile

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
11
FROM ubuntu:24.04
22

3+
ENV DEBIAN_FRONTEND=noninteractive
4+
35
RUN apt-get update && apt-get install -y --no-install-recommends \
4-
git \
5-
curl \
6-
wget \
7-
jq \
8-
tree \
9-
ripgrep \
10-
fd-find \
11-
make \
12-
gcc \
13-
python3 \
14-
python3-pip \
15-
nodejs \
16-
npm \
17-
ca-certificates \
18-
openssh-client \
19-
&& rm -rf /var/lib/apt/lists/*
6+
git curl wget jq tree ripgrep fd-find make gcc g++ \
7+
python3 python3-pip python3-venv \
8+
nodejs npm \
9+
ca-certificates openssh-client unzip xz-utils \
10+
&& rm -rf /var/lib/apt/lists/* \
11+
&& ln -sf /usr/bin/fdfind /usr/bin/fd
2012

21-
# Create symlinks for common tool names
22-
RUN ln -sf /usr/bin/fdfind /usr/bin/fd
13+
# Install Go
14+
RUN curl -fsSL https://go.dev/dl/go1.26.1.linux-$(dpkg --print-architecture).tar.gz \
15+
| tar -C /usr/local -xz
2316

24-
# Set reasonable defaults
17+
ENV PATH="/usr/local/go/bin:${PATH}"
18+
ENV GOPATH="/root/go"
19+
ENV PATH="${GOPATH}/bin:${PATH}"
2520
ENV TERM=xterm-256color
2621
ENV LANG=C.UTF-8
27-
28-
WORKDIR /workspace

0 commit comments

Comments
 (0)