devbox/Dockerfile
shoemoney 44e142fdf0 feat: cross-platform install scripts + hub Docker + macOS Full Disk Access 📦🐳🔐
Maximum-easy adoption:
- install.sh (macOS+Linux): curl|sh friendly. Detects OS/arch, resolves the
  binary (env → local dist/ → download → go-build fallback), lets you pick the
  install dir (smart default + prompt on a TTY), and optionally sets up a
  KEEP-ALIVE auto-restart service — launchd KeepAlive (mac) / systemd
  Restart=always user unit (linux). Flags + env for non-interactive use.
- install.ps1 (Windows): copy exe + user PATH + optional restart-on-failure
  Scheduled Task at logon.
- Hub Docker: Dockerfile (multi-stage, static CGO-free, alpine, healthcheck-
  ready) + docker-compose.yml (restart: unless-stopped = self-heal, named
  volume, dashboard-ready, optional autoheal profile for unhealthy-restart) +
  .dockerignore — drop-in for TrueNAS/Synology/unRAID.
- macOS Full Disk Access: 'devbox doctor' now tests the ACTUAL protected mount
  paths (~/Desktop, ~/Documents, ~/Downloads, iCloud) and flags any it can't
  read, with the exact System Settings fix + a deep link; install.sh points to
  it on mac. Windows install.ps1 notes Controlled Folder Access (off by default).
  (TCC.db probe was unreliable across macOS versions — testing the real mounts
  is honest + version-proof.) shellcheck-clean; 18 pkgs -race green; win+mac build.
2026-06-23 13:05:16 -05:00

28 lines
1.2 KiB
Docker

# devbox hub — multi-stage, static (CGO-free, pure-Go sqlite), tiny final image.
# Build: docker build -t devbox-hub .
# Run: docker run -d --restart unless-stopped -p 8088:8088 -v devbox:/data devbox-hub
# (or just `docker compose up -d` — see docker-compose.yml)
FROM golang:1.26-alpine AS build
WORKDIR /src
# cache deps separately from source for faster rebuilds
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=docker
# CGO off -> a fully static binary that runs on scratch/alpine without libc.
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" \
-o /out/devbox-hub ./cmd/devbox-hub
FROM alpine:3.20
# ca-certificates + tzdata for correct TLS/timestamps; wget (busybox) backs the healthcheck.
RUN apk add --no-cache ca-certificates tzdata && adduser -D -u 10001 devbox
COPY --from=build /out/devbox-hub /usr/local/bin/devbox-hub
USER devbox
VOLUME /data
# 8088 = hub API · 8099 = live dashboard (only reachable if you enable --dashboard)
EXPOSE 8088 8099
# ENTRYPOINT is just the binary so `command:` / `docker run … <args>` can tweak flags
# (e.g. add --dashboard). Default CMD serves the hub on all interfaces.
ENTRYPOINT ["devbox-hub"]
CMD ["serve", "--data", "/data", "--listen", "0.0.0.0:8088"]