-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDockerfile
More file actions
124 lines (111 loc) · 4.68 KB
/
Copy pathDockerfile
File metadata and controls
124 lines (111 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Dockerfile for testing a build of vix in a clean container.
#
# Two install modes, selected by VIX_INSTALL_MODE:
#
# release (default) — vix is installed via the official installer
# (https://getvix.dev/install.sh), which drops both the `vix` CLI and the
# `vixd` daemon into /usr/local/bin. Nothing from the local repo is used.
#
# source — the static Linux binaries built locally by script/build.sh
# (bin/vix-linux-<arch>, bin/vixd-linux-<arch>) are COPYed into the image.
# Build them first: `script/build.sh`.
#
# Running `vix` auto-spawns `vixd`, so a shell with both on PATH is all you need.
#
# Build (release):
# docker build --build-arg VIX_VERSION=latest -t vix-test .
# Build (source — requires bin/ populated by script/build.sh first):
# docker build --build-arg VIX_INSTALL_MODE=source -t vix-test .
# Run:
# docker run --rm -it -e ANTHROPIC_API_KEY vix-test
#
# Prefer the script/vix-docker.sh wrapper, which handles platform, build args,
# and (for source mode) running script/build.sh for you.
# Select which install stage becomes the final image: "release" or "source".
# Declared in the global scope so it can be used in the `FROM ${VIX_INSTALL_MODE}`
# selector below.
ARG VIX_INSTALL_MODE=release
# ── Base: common OS + tooling shared by both install modes ────────────────────
FROM debian:stable-slim AS base
# Dependencies:
# ca-certificates curl wget -> download release + checksums over HTTPS
# tar gzip unzip -> extract archives
# coreutils -> sha256sum for checksum verification
# gnupg -> optional GPG signature verification
# git -> vix shells out to git for many tasks
# bash less vim nano -> shell + editors / pager
# procps psmisc htop -> ps, top, kill, htop (process inspection)
# iproute2 -> ss / ip (networking)
# jq ripgrep tree file -> common everyday CLI tools
# sudo -> so you can install more packages interactively
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash \
ca-certificates \
coreutils \
curl \
file \
git \
gnupg \
gzip \
htop \
iproute2 \
jq \
less \
nano \
procps \
psmisc \
ripgrep \
sudo \
tar \
tree \
unzip \
vim \
wget \
&& rm -rf /var/lib/apt/lists/*
# ── release: install vix from the official installer ──────────────────────────
FROM base AS release
# Version of vix to install: "latest", "1.2.3", or "v1.2.3".
# Declared as an ARG so changing it busts the install layer's cache.
ARG VIX_VERSION=latest
# When true, the installer fails (rather than silently downgrading to
# checksum-only verification) if the GPG signature can't be verified.
ARG VIX_FORCE_GPG=false
# As root, /usr/local/bin is writable, so the installer needs no sudo and runs
# without interactive prompts.
RUN set -eux; \
args="${VIX_VERSION} --no-fancy"; \
if [ "${VIX_FORCE_GPG}" = "true" ]; then args="${args} --force-gpg-verification"; fi; \
curl -fsSL https://getvix.dev/install.sh | bash -s -- ${args}; \
vix --version
# ── source: copy locally-built static binaries from script/build.sh ───────────
# TARGETARCH is set automatically by BuildKit from --platform (amd64 / arm64),
# matching the naming script/build.sh uses for its loose binaries.
FROM base AS source
ARG TARGETARCH
COPY bin/vix-linux-${TARGETARCH} /usr/local/bin/vix
COPY bin/vixd-linux-${TARGETARCH} /usr/local/bin/vixd
RUN set -eux; \
chmod +x /usr/local/bin/vix /usr/local/bin/vixd; \
vix --version
# ── final: pick the selected install stage, then add shared runtime config ────
FROM ${VIX_INSTALL_MODE} AS final
# Handy interactive-shell aliases for the throwaway test container.
RUN echo "alias ll='ls -al'" >> /root/.bashrc
WORKDIR /workspace
# Entrypoint: seed /workspace/.env from a read-only mount at /seed/.env (if the
# host provided one), so `vix` picks up the API key with zero extra steps. It's
# a copy, not the mount itself, so you can `rm /workspace/.env` inside the
# container to drop the key and enter it yourself. We never bake the key into
# the image — the .env only arrives via a runtime bind mount.
RUN cat > /usr/local/bin/vix-docker-entrypoint.sh <<'EOF' \
&& chmod +x /usr/local/bin/vix-docker-entrypoint.sh
#!/usr/bin/env bash
set -e
if [ -f /seed/.env ] && [ ! -f /workspace/.env ]; then
cp /seed/.env /workspace/.env
fi
exec "$@"
EOF
ENTRYPOINT ["vix-docker-entrypoint.sh"]
CMD ["bash"]