@@ -133,6 +133,65 @@ function getDownloadUrl(os: OS, profile: Profile, libc: Libc): string {
133133 return `https://github.com/ScriptSmith/hadrian/releases/latest/download/hadrian-${ target } -${ profile } .${ ext } ` ;
134134}
135135
136+ const dockerSimpleCommand = [
137+ "docker run -p 8080:8080 \\" ,
138+ " -v hadrian-data:/app/data \\" ,
139+ " ghcr.io/scriptsmith/hadrian" ,
140+ ] . join ( "\n" ) ;
141+
142+ const dockerConfigCommand = [
143+ "cat <<'EOF' > hadrian.toml" ,
144+ "[server]" ,
145+ 'host = "0.0.0.0"' ,
146+ "port = 8080" ,
147+ "" ,
148+ "[database]" ,
149+ 'type = "sqlite"' ,
150+ 'path = "/app/data/hadrian.db"' ,
151+ "" ,
152+ "[cache]" ,
153+ 'type = "memory"' ,
154+ "" ,
155+ "[ui]" ,
156+ "enabled = true" ,
157+ "EOF" ,
158+ "" ,
159+ "docker run -p 8080:8080 \\" ,
160+ " -v ./hadrian.toml:/app/config/hadrian.toml:ro \\" ,
161+ " -v hadrian-data:/app/data \\" ,
162+ " ghcr.io/scriptsmith/hadrian" ,
163+ ] . join ( "\n" ) ;
164+
165+ function CommandBlock ( { command, label } : { command : string ; label ?: string } ) {
166+ const [ copied , setCopied ] = useState ( false ) ;
167+ const handleCopy = async ( ) => {
168+ await navigator . clipboard . writeText ( command ) ;
169+ setCopied ( true ) ;
170+ setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
171+ } ;
172+ return (
173+ < div >
174+ { label && (
175+ < div className = "border-b border-fd-border px-4 py-2" >
176+ < span className = "text-xs font-medium text-fd-muted-foreground" > { label } </ span >
177+ </ div >
178+ ) }
179+ < div className = "relative" >
180+ < pre className = "overflow-x-auto whitespace-pre-wrap break-all p-4 pr-12 text-sm" >
181+ < code className = "text-fd-foreground" > { command } </ code >
182+ </ pre >
183+ < button
184+ onClick = { handleCopy }
185+ className = "absolute right-3 top-3 rounded-md p-1.5 text-fd-muted-foreground transition-colors hover:bg-fd-muted hover:text-fd-foreground"
186+ aria-label = "Copy command"
187+ >
188+ { copied ? < Check className = "h-4 w-4 text-green-500" /> : < Copy className = "h-4 w-4" /> }
189+ </ button >
190+ </ div >
191+ </ div >
192+ ) ;
193+ }
194+
136195function ToggleGroup < T extends string > ( {
137196 options,
138197 value,
@@ -184,8 +243,6 @@ export function QuickStartSelector() {
184243 const [ os , setOs ] = useState < OS > ( "linux-x86_64" ) ;
185244 const [ profile , setProfile ] = useState < Profile > ( "standard" ) ;
186245 const [ libc , setLibc ] = useState < Libc > ( "musl" ) ;
187- const [ copied , setCopied ] = useState ( false ) ;
188-
189246 const isLinux = os === "linux-x86_64" || os === "linux-arm64" ;
190247 const disabledProfiles = getDisabledProfiles ( os , libc ) ;
191248 const disabledLibcs = os === "linux-arm64" ? new Set < Libc > ( [ "musl" ] ) : undefined ;
@@ -213,12 +270,6 @@ export function QuickStartSelector() {
213270 const command = getInstallCommand ( method , os , profile , libc ) ;
214271 const downloadUrl = method === "binary" ? getDownloadUrl ( os , profile , libc ) : null ;
215272
216- const handleCopy = async ( ) => {
217- await navigator . clipboard . writeText ( command ) ;
218- setCopied ( true ) ;
219- setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
220- } ;
221-
222273 return (
223274 < div className = "not-prose overflow-hidden rounded-lg border border-fd-border bg-fd-card" >
224275 < div className = "space-y-3 border-b border-fd-border bg-fd-muted/50 p-4" >
@@ -334,20 +385,16 @@ export function QuickStartSelector() {
334385 allow = "clipboard-read; clipboard-write"
335386 />
336387 </ div >
337- ) : (
388+ ) : method === "docker" ? (
338389 < >
339- < div className = "relative" >
340- < pre className = "overflow-x-auto whitespace-pre-wrap break-all p-4 pr-12 text-sm" >
341- < code className = "text-fd-foreground" > { command } </ code >
342- </ pre >
343- < button
344- onClick = { handleCopy }
345- className = "absolute right-3 top-3 rounded-md p-1.5 text-fd-muted-foreground transition-colors hover:bg-fd-muted hover:text-fd-foreground"
346- aria-label = "Copy command"
347- >
348- { copied ? < Check className = "h-4 w-4 text-green-500" /> : < Copy className = "h-4 w-4" /> }
349- </ button >
390+ < CommandBlock command = { dockerSimpleCommand } label = "Run" />
391+ < div className = "border-t border-fd-border" >
392+ < CommandBlock command = { dockerConfigCommand } label = "With configuration" />
350393 </ div >
394+ </ >
395+ ) : (
396+ < >
397+ < CommandBlock command = { command } />
351398
352399 { downloadUrl && (
353400 < div className = "border-t border-fd-border bg-fd-muted/30 px-4 py-3" >
0 commit comments