Skip to content

Commit

Permalink
Dockerfile action: README.md add build_context example
Browse files Browse the repository at this point in the history
Signed-off-by: Ash <[email protected]>
  • Loading branch information
iutx committed Sep 13, 2024
1 parent 8e94fb4 commit c497e89
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions actions/dockerfile/1.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#### 使用

dockerfile 位于应用根目录:
1. dockerfile 位于应用根目录:

```yml
- dockerfile:
Expand All @@ -16,11 +16,38 @@ dockerfile 位于应用根目录:
NODE_OPTIONS: --max_old_space_size=3040
```
dockerfile 位于应用子目录下:
2. dockerfile 位于应用子目录下:
```yml
- dockerfile:
params:
workdir: ${git-checkout}
path: subdir/Dockerfile
```
3. 构建上下文配置
```yml
- stage:
- git-checkout:
alias: git-checkout
version: "1.0"
...
- git-checkout:
alias: other-repo
version: "1.0"
...
- stage:
- dockerfile:
params:
build_context:
other-resource: ${other-repo}
workdir: ${git-checkout}
path: subdir/Dockerfile
```
`Dockerfile` 中,使用 `COPY` 指令从不同的构建上下文(如 other-resource)中复制资源:

```Dockerfile
COPY --from=other-resource <source_path> <target_path>
```

0 comments on commit c497e89

Please sign in to comment.