Skip to content

Commit

Permalink
feat(docker): add buildkit option
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Dec 31, 2021
1 parent 96803da commit f98c8ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Builds a docker image from a Dockerfile. Layers are cached and pruned between jo
| No | `context` | Directory to build from | `./docker` | `.` |
| No | `docker_args` | Arguments to pass to docker build | `--target prod` | |
| No | `prune_after` | Amount of time until which images get pruned | `24h` | `260h` (2 weeks) |
| No | `buildkit` | Whether to use Docker BuildKit | `true` | `false` |

#### Outputs

Expand All @@ -141,6 +142,7 @@ Builds a docker image from a Dockerfile. Layers are cached and pruned between jo
dockerfile: Dockerfile
context: .
docker_args: --target test
buildkit: true

- run: docker run ${{ steps.docker.outputs.tagged_image }}
```
Expand Down
7 changes: 7 additions & 0 deletions build-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ inputs:
required: false
default: '260h'

buildkit:
description: 'Whether to use Docker BuildKit'
required: false
default: 'false'

outputs:
tagged_image:
description: 'Created image name with tag'
Expand Down Expand Up @@ -69,6 +74,8 @@ runs:
--tag ${{ steps.prep.outputs.tagged_image }} \
--file ${{ inputs.dockerfile }} \
${{ inputs.context }}
env:
DOCKER_BUILDKIT: ${{ inputs.buildkit == 'false' && '0' || '1' }}

- name: 'Prune previous images'
shell: bash
Expand Down

0 comments on commit f98c8ba

Please sign in to comment.