Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- uses: cfpb/actions/docker-build-push@main
with:
image-name: myapp
token: ${{ secrets.GITHUB_TOKEN }}
```

#### Build with custom Docker context
Expand All @@ -41,6 +42,7 @@ jobs:
- uses: cfpb/actions/docker-build-push@main
with:
image-name: myapp
token: ${{ secrets.GITHUB_TOKEN }}
context: ./path/to/dockerfile/
```

Expand All @@ -50,6 +52,7 @@ jobs:
- uses: cfpb/actions/docker-build-push@main
with:
image-name: myapp
token: ${{ secrets.GITHUB_TOKEN }}
skip-push: true
```

Expand All @@ -61,6 +64,7 @@ Test command receives `IMAGE` as an environment variable.
- uses: cfpb/actions/docker-build-push@main
with:
image-name: myapp
token: ${{ secrets.GITHUB_TOKEN }}
test-command: my-test-command.sh
```

Expand All @@ -69,6 +73,7 @@ Test command receives `IMAGE` as an environment variable.
| Input | Required | Default | Description |
| -------------- | -------- | ------- | ------------------------------------------------------------------ |
| `image-name` | Yes | - | Name for the image (e.g. "myapp" → ghcr.io/cfpb/myapp) |
| `token` | Yes | - | GitHub token for registry authentication |
| `context` | No | `.` | Docker build context |
| `skip-push` | No | `false` | Skip pushing (build only) |
| `test-command` | No | | Test command to run against built image. Receives `IMAGE` env var. |
Expand Down
5 changes: 4 additions & 1 deletion docker-build-push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
image-name:
description: Name for the image (e.g. "myapp" → ghcr.io/cfpb/myapp)
required: true
token:
description: GitHub token for registry authentication
required: true
context:
description: Docker build context
required: false
Expand Down Expand Up @@ -178,7 +181,7 @@ runs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ inputs.token }}

- name: Push image
id: push
Expand Down