An open API service indexing awesome lists of open source software.

https://github.com/ambimax/action-docker-build

:zap::octocat: GitHub Action to build docker images
https://github.com/ambimax/action-docker-build

docker docker-compose github-actions

Last synced: 6 months ago
JSON representation

:zap::octocat: GitHub Action to build docker images

Awesome Lists containing this project

README

          

ambimax/action-docker-build


GitHub Action to build docker images.


## Introduction

GitHub Action to build docker images.

## Usage

Example workflow:

```yml
name: Build image

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: ambimax/action-docker-build@v1
```

### [dockerfile](test/01-dockerfile)

Build a single docker file in the root of the repository.

```yml
- uses: ambimax/action-docker-build@v1
```

### [dockerfile-custom](test/02-dockerfile-custom)

Build a dockerfile from a custom directory.

**NOTE** The build context will still be the root of the repository.

```yml
- uses: ambimax/action-docker-build@v1
with:
dockerfile: docker/Dockerfile
```

### [dockerfile-context](test/03-dockerfile-context)

Build a dockerfile from a custom context.

```yml
- uses: ambimax/action-docker-build@v1
with:
context: packages/hello-world
dockerfile: packages/hello-world/Dockerfile
```

### [dockercompose](test/04-dockercompose)

Build a docker-compose.yml.

```yml
- uses: ambimax/action-docker-build@v1
with:
composefile: docker-compose.yml
tag: hello-world
```

### [dockerfile-private-registry](test/05-dockerfile-private-registry)

Build a Dockerfile that needs an image from a private registry.

```yml
- 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
```

### [dockerfile-tags](test/06-dockerfile-tags)

Build an image from a Dockerfile with multiple tags.

```yml
- uses: ambimax/action-docker-build@v1
with:
dockerfile: dockerfiles/Dockerfile
tags: |
hello-world:latest
hello-world:c0ffee
hello-world:f00babe
```

## Available parameters

| 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 | |

## Development

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 \...\ are autogenerated.

## License

[MIT](LICENSE)

## Author Information

- [Tobias Faust](https://github.com/FaustTobias), [ambimax® GmbH](https://ambimax.de)
- [Dominik Wißler](https://github.com/Wysselbie), [ambimax® GmbH](https://ambimax.de)