https://github.com/imatic/imatic-build-action
https://github.com/imatic/imatic-build-action
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/imatic/imatic-build-action
- Owner: imatic
- Created: 2023-12-12T15:14:11.000Z (over 2 years ago)
- Default Branch: dev
- Last Pushed: 2024-10-08T22:09:34.000Z (over 1 year ago)
- Last Synced: 2025-03-26T20:01:42.316Z (about 1 year ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 }}
```