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

https://github.com/imatic/imatic-build-action


https://github.com/imatic/imatic-build-action

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Imatic Build Action

Builds docker-compose based project images and pushes them to registry.

All services with build key are built and tagged with provided tags. Tags and
image names should be generated by using environment variables provided by this
action. For example:

- `PROJECT_IMAGE` - image name
- `PROJECT_VERSION` - image version

```yaml
services:
frontend:
image: ${PROJECT_IMAGE:-my-project-name}:${PROJECT_VERSION:-latest}
build:
context: .
args:
- MY_APP_VERSION=${PROJECT_VERSION:-latest}
```

These variables are also returned in output of this action as `project-image`
and `project-version` respectively. Use these if you need to spin up built
images in the workflow.

## Options

You can specify following options in `with` section of this action:

- `registry` - registry to push images to. Default is `ghcr.io`.
- `build` - build images. Default is `true`.
- `push` - push images to registry. Default is `true`.
- `docker_compose_file` - path to docker-compose file. Default is `docker-compose.yml`.

## Usage in workflow

An example usage of this action in build workflow.

```yaml
name: Build Image

on:
workflow_call:
workflow_dispatch:
push:
branches: [main]

env:
REGISTRY: ghcr.io

jobs:
build_image:
name: Build Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & push
uses: imatic/imatic-build-action
with:
registry: ${{ env.REGISTRY }}
```