Skip to content

Commit

Permalink
Cache prompt repo clones in a volume (#20)
Browse files Browse the repository at this point in the history
* Cache prompt repo clones in a volume

Use a volume mount to cache the prompt repos between clones

* Fixes automatic pull of vonwig/prompts

The default value of promptImage will normally be tagged with latest
so this code was not doing anything.
  • Loading branch information
slimslenderslacks authored Jun 10, 2024
1 parent 205ea01 commit 24b4e63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/preparePrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type PromptTypes = [{ title: string, type: string }];

export const getPromptTypes = function (): PromptTypes {
const promptImage = vscode.workspace.getConfiguration('docker.make-runbook').get('prompt-image') as string;
if (promptImage === "vonwig/prompts") {
if (promptImage === "vonwig/prompts" || promptImage === "vonwig/prompts:latest") {
spawnSync('docker', ['pull', "vonwig/prompts"]);
}
const result = spawnSync('docker', ['run', '--rm', promptImage, "prompts"]);
Expand All @@ -18,7 +18,7 @@ export const prepareProjectPrompt = (projectRoot: vscode.WorkspaceFolder, userna

const promptImage = vscode.workspace.getConfiguration('docker.make-runbook').get('prompt-image') as string;

const result = spawnSync('docker', ['run', '--rm', "-v", "/var/run/docker.sock:/var/run/docker.sock", promptImage, projectRoot.uri.fsPath, username, platform, promptType]);
const result = spawnSync('docker', ['run', '--rm', "-v", "/var/run/docker.sock:/var/run/docker.sock", "--mount", "type=volume,source=docker-prompts,target=/prompts", promptImage, projectRoot.uri.fsPath, username, platform, promptType]);

if (result.error) {
throw result.error;
Expand Down

0 comments on commit 24b4e63

Please sign in to comment.