Skip to content

Commit 09b24bb

Browse files
Test prompts with ollama models
1 parent 4f4b9e9 commit 09b24bb

File tree

9 files changed

+123
-0
lines changed

9 files changed

+123
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
You are an assistant who specializes in authoring Dockerfiles for projects.
2+
Since you are an expert and know about their project, be definitive about recommendations.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Write Dockerfiles using three stages. Here are the three stages to use:
2+
1. the first stage should be called "deps"
3+
and it should fetch the runtime dependencies using npm ci
4+
`with the --omit=dev` flag.
5+
2. The second stage should be called build
6+
and it should be based on the deps stage.
7+
It should run npm ci first and then it should run npm build
8+
3. The third stage should start with a FROM line that uses the `node` base image.
9+
This stage should do then do three things.
10+
1. it copies the node_modules directory from the deps stage.
11+
2. it copies the dist directory from the build stage.
12+
3. it should then create an entrypoint that runs npm start
13+
14+
If you need to use a RUN statement containing `npm ci` always
15+
add the argument `--mount=type=cache,target=/root/.npm` to the RUN instruction.
16+
The `--mount` argument should be placed between the word RUN and the npm command.
17+
This will cache the npm packages in the docker build cache and speed up the build process.
18+
19+
* Generate a Dockerfile for an NPM project.
20+
* Call a function to get the recommended tag for repository `node`
21+
* In each FROM line in the Dockerfile, use the recommended tag.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
extractors:
3+
- name: go-linguist
4+
tool_choice: auto
5+
model: gpt-4
6+
stream: true
7+
functions:
8+
- name: docker_scout_tag_recommendation
9+
---
10+
11+
# Background
12+
13+
These prompts add Dockerfile authoring skills to the assistant.
14+
15+
* the [user prompts](100_user_prompt.md) direct the assist to extract details about the project, and then write a Dockerfile to the root of the project.
16+
* the [npm best practices](npm-best-practices.md) is are added to the system prompts whenever the assist detects that this is an NPM project.
17+
18+
## functions
19+
20+
These instructions in these prompts rely on 3 functions
21+
22+
1. `analyze_project` - requires read-only access to the project and extracts details from the project to give the assistant context for authoring the Dockerfile
23+
2. `write_files` - has read-write access to the project and will write Dockerfiles so that developers don't have to copy and paste data out of a chat.
24+
3. `docker_scout_tag_recommendation` - uses Docker Scout to improve the choice tag selection during code generation.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
You are an assistant who specializes in authoring Dockerfiles for projects.
2+
Since you are an expert and know about their project, be definitive about recommendations.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Write Dockerfiles for NPM projects using three stages. Do these three steps sequentially.
2+
* the first node depemdencies stage should be called "deps"
3+
and it should fetch the runtime dependencies using npm ci
4+
`with the --omit=dev` flag.
5+
* The second Dockerfile stage should be called build
6+
and it should be based on the deps stage.
7+
It should run npm ci and then npm build
8+
* The third Dockerfile stage should select a base image
9+
that is recommended by Scout and use that in the FROM line.
10+
This stage should do then do three things.
11+
1. it copies the node_modules directory from the deps stage.
12+
2. it copies the dist directory from the build stage.
13+
3. it then runs npm start
14+
15+
If you need to use a RUN statement containing `npm ci` always
16+
add the argument `--mount=type=cache,target=/root/.npm` to the RUN instruction.
17+
The `--mount` argument should be placed between the word RUN and the npm command.
18+
This will cache the npm packages in the docker build cache and speed up the build process.
19+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
extractors:
3+
- name: go-linguist
4+
tool_choice: auto
5+
model: gpt-4
6+
stream: true
7+
functions:
8+
- name: docker_scout_tag_recommendation
9+
---
10+
11+
# Background
12+
13+
These prompts add Dockerfile authoring skills to the assistant.
14+
15+
* the [user prompts](100_user_prompt.md) direct the assist to extract details about the project, and then write a Dockerfile to the root of the project.
16+
* the [npm best practices](npm-best-practices.md) is are added to the system prompts whenever the assist detects that this is an NPM project.
17+
18+
## functions
19+
20+
These instructions in these prompts rely on 3 functions
21+
22+
1. `analyze_project` - requires read-only access to the project and extracts details from the project to give the assistant context for authoring the Dockerfile
23+
2. `write_files` - has read-write access to the project and will write Dockerfiles so that developers don't have to copy and paste data out of a chat.
24+
3. `docker_scout_tag_recommendation` - uses Docker Scout to improve the choice tag selection during code generation.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You are a Docker expert.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
What is the recommended tag to use for the `hazy` repository? Use the output from the recommendation function to answer this question.

prompts/recommended_tags/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
extractors:
3+
tool_choice: auto
4+
model: gpt-4
5+
stream: true
6+
functions:
7+
- name: docker_scout_tag_recommendation
8+
---
9+
10+
# Background
11+
12+
```sh
13+
# docker:command=recommended-tags
14+
bb -m prompts run \
15+
--host-dir /Users/slim/docker/labs-make-runbook \
16+
--user jimclark106 \
17+
--platform darwin \
18+
--prompts-dir prompts/recommended_tags \
19+
--url http://localhost:11434/v1/chat/completions \
20+
--model "mistral-nemo" \
21+
--nostream \
22+
```
23+
24+
25+
## functions
26+
27+
These instructions in these prompts rely on 3 functions
28+
29+
3. `docker_scout_tag_recommendation` - uses Docker Scout to improve the choice tag selection during code generation.

0 commit comments

Comments
 (0)