GitHub Action to build docker images.
GitHub Action to build docker images.
Example workflow:
name: Build image
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ambimax/action-docker-build@v1
Build a single docker file in the root of the repository.
- uses: ambimax/action-docker-build@v1
Build a dockerfile from a custom directory.
NOTE The build context will still be the root of the repository.
- uses: ambimax/action-docker-build@v1
with:
dockerfile: docker/Dockerfile
Build a dockerfile from a custom context.
- uses: ambimax/action-docker-build@v1
with:
context: packages/hello-world
dockerfile: packages/hello-world/Dockerfile
Build a docker-compose.yml.
- uses: ambimax/action-docker-build@v1
with:
composefile: docker-compose.yml
tag: hello-world
Build a Dockerfile that needs an image from a private registry.
- uses: ambimax/action-docker-build@v1
with:
dockerfile: dockerfiles/Dockerfile.fpm
tag: node-exec-opt-app-index
registry: docker-registry.ambimax.xyz
username: test
password: test
Build an image from a Dockerfile with multiple tags.
- uses: ambimax/action-docker-build@v1
with:
dockerfile: dockerfiles/Dockerfile
tags: |
hello-world:latest
hello-world:c0ffee
hello-world:f00babe
Name | description | required | default |
---|---|---|---|
dockerfile | The Dockerfile to build. | false | Dockerfile |
composefile | The docker-compose file to build. Providing this input will ignore: dockerfile, context, tag | false | |
context | The build context to use. | false | . |
tag | The tag to use for the image. Required for dockerfile building. |
false | docker-image:latest |
tags | To use multiple tags for the image. Use ' |
' and line breaks. Required for dockerfile building if no 'tag' property is provided. |
false |
registry | The private registry that is referenced in a Dockerfile or docker-compose.yml. Required with username and password . |
false | |
username | The login username for the private registry. Required with registry and password . |
false | |
password | The login password for the private registry. Required with registry and username . |
false |
Clone this repository
git clone https://github.com/ambimax/action-docker-build
Install all dependencies
yarn
Build the project
yarn build
Once done, commit the dist folder to a new feature branch and create a pull request.
NOTE This project makes heavy use of code generation. You really only want to edit action.yml, src/index.ts and the test folder. Sections in this readme marked with <!-- region:xyz start -->...<!-- region:xyz end --> are autogenerated.