-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.demo
More file actions
121 lines (110 loc) · 4.67 KB
/
Dockerfile.demo
File metadata and controls
121 lines (110 loc) · 4.67 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
# Dockerfile for recording demos with promptarena
# Supports: VHS (GIF), asciinema (.cast)
#
# Usage:
# make demo-build # Build container
# make demo-run # Interactive shell
# make demo-vhs-docker # Record all VHS tapes
#
# Or manually:
# docker build -t promptarena-demo -f Dockerfile.demo .
# docker run -it --rm \
# -v $(pwd)/examples:/demo \
# -v $(pwd)/recordings:/recordings \
# --env-file .env.demo \
# promptarena-demo
#
# Inside container:
# vhs /recordings/tapes/01-install.tape # Record single tape
# record-all # Record all tapes
# asciinema rec /recordings/my-demo.cast # Interactive recording
#
# NOTE: API keys are passed via --env-file and never appear in recordings
FROM golang:1.26-alpine
# Install dependencies, fonts, and VHS in a single layer
# - System packages and tools
# - JetBrains Mono Nerd Font for terminal icons
# - Noto Color Emoji for full emoji support in Chromium
# - VHS (Charmbracelet) for GIF recording
RUN apk add --no-cache \
bash \
bash-completion \
chromium \
curl \
ffmpeg \
font-jetbrains-mono \
font-noto-emoji \
fontconfig \
git \
ncurses \
nodejs \
npm \
py3-pip \
python3 \
ttyd \
&& pip3 install --break-system-packages asciinema \
&& fc-cache -f \
# Install JetBrains Mono Nerd Font for icons in terminal recordings
&& mkdir -p /usr/share/fonts/nerd-fonts \
&& curl -fsSL https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/JetBrainsMono.tar.xz \
| tar -xJ -C /usr/share/fonts/nerd-fonts \
&& curl -fsSL https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf \
-o /usr/share/fonts/nerd-fonts/NotoColorEmoji.ttf \
&& fc-cache -f \
# Install VHS (Charmbracelet) for GIF recording
&& curl -fsSL https://github.com/charmbracelet/vhs/releases/download/v0.10.0/vhs_0.10.0_Linux_x86_64.tar.gz \
| tar -xz --strip-components=1 -C /usr/local/bin vhs_0.10.0_Linux_x86_64/vhs \
&& chmod +x /usr/local/bin/vhs
# Set clean, minimal prompt (just colored $)
ENV PS1='\[\e[35m\]$\[\e[0m\] '
ENV TERM=xterm-256color
ENV COLORTERM=truecolor
# Disable shell history for clean recordings
ENV HISTFILE=/dev/null
# VHS uses chromium for rendering
ENV CHROME_PATH=/usr/bin/chromium-browser
ENV VHS_NO_SANDBOX=true
# Copy promptarena binary (built for linux/amd64)
# Build with: GOOS=linux GOARCH=amd64 go build -o bin/promptarena-linux ./tools/arena
COPY bin/promptarena-linux /usr/local/bin/promptarena
# Copy packc binary (built for linux/amd64)
# Build with: GOOS=linux GOARCH=amd64 go build -o bin/packc-linux ./tools/packc
COPY bin/packc-linux /usr/local/bin/packc
# Set up shell environment:
# - Disable terminal bell (audible and visible)
# - Create env-safe wrapper to filter API keys from output
# - Configure bash completions for login shells
# - Add record-all helper script for VHS
# Note: Alpine sources /etc/profile.d/*.sh for login shells
RUN echo 'set bell-style none' >> /etc/inputrc && \
echo '#!/bin/bash\n/usr/bin/env "$@" | grep -v "_API_KEY\|_SECRET\|_TOKEN"' > /usr/local/bin/env-safe && \
chmod +x /usr/local/bin/env-safe && \
chmod +x /usr/local/bin/promptarena && \
chmod +x /usr/local/bin/packc && \
mkdir -p /etc/bash_completion.d /recordings/gifs && \
promptarena completion bash > /etc/bash_completion.d/promptarena && \
packc completion bash > /etc/bash_completion.d/packc && \
echo '#!/bin/bash' > /etc/profile.d/completions.sh && \
echo '[ -f /usr/share/bash-completion/bash_completion ] && \
source /usr/share/bash-completion/bash_completion' \
>> /etc/profile.d/completions.sh && \
echo 'source /etc/bash_completion.d/promptarena' >> /etc/profile.d/completions.sh && \
echo 'source /etc/bash_completion.d/packc' >> /etc/profile.d/completions.sh && \
chmod +x /etc/profile.d/completions.sh && \
echo '#!/bin/bash' > /usr/local/bin/record-all && \
echo 'echo "Recording all VHS tapes..."' >> /usr/local/bin/record-all && \
echo 'for tape in /recordings/tapes/*.tape; do' >> /usr/local/bin/record-all && \
echo ' echo "Recording $tape..."' >> /usr/local/bin/record-all && \
echo ' vhs "$tape" || echo "Failed: $tape"' >> /usr/local/bin/record-all && \
echo 'done' >> /usr/local/bin/record-all && \
echo 'echo "Done! GIFs saved to /recordings/gifs/"' >> /usr/local/bin/record-all && \
chmod +x /usr/local/bin/record-all
# Copy local Go modules so SDK demos use local code instead of fetching from internet
COPY go.work /promptkit/go.work
COPY sdk /promptkit/sdk
COPY runtime /promptkit/runtime
COPY pkg /promptkit/pkg
# Set working directory
WORKDIR /demo
# Default shell
CMD ["bash"]