https://github.com/sclorg/build-and-push-action
https://github.com/sclorg/build-and-push-action
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sclorg/build-and-push-action
- Owner: sclorg
- License: mit
- Created: 2022-02-15T12:42:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T14:23:37.000Z (about 2 years ago)
- Last Synced: 2024-10-30T00:32:02.492Z (over 1 year ago)
- Language: Python
- Size: 34.2 KB
- Stars: 0
- Watchers: 6
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The Build and Push GitHub Action
The action builds a container image and pushes it to the specified registry.
The path to upload the image is constructed from inputs as follows:
```
registry/registry_namespace/image_name
```
## Action Inputs
### Registry information
| Input Name | Description | Default value |
|------------|-------------|---------------|
| `registry` | Registry to push container image to. | **required** |
| `registry_namespace` | Namespace of the registry, where the image would be pushed. | **required** |
| `registry_username` | Login to specified registry. | **required** |
| `registry_token` | Access token to specified registry. | **required** |
### Build information
| Input Name | Description | Default value |
|------------|-------------|---------------|
| `image_name` | Name of the built image. | **required** |
| `tag` | Tag of the built image. | "" |
| `use_default_tags` | Add default tags to image - SHA, latest, current date | true |
| `archs` | Label the image with this architecture. For multiple architectures, seperate them by a comma. | amd64 |
| `dockerfile` | Dockerfile and its relative path to build the image. | Dockerfile |
| `docker_context` | Docker build context. | . |
### Other information
| Input Name | Description | Default value |
|------------|-------------|---------------|
| `readme` | If path to readme is set, the readme is updated to the registry. Only quay.io is supported. | "" |
| `quay_application_token` | Application token is used for updating description for image. | "" |
## Example
The example below shows how the `sclorg/build-and-push-action` can be used.
```yaml
name: Build and push to quay.io registry
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-20.04
steps:
- name: Build and push to quay.io registry
uses: sclorg/build-and-push-action@v2
with:
registry: "quay.io"
registry_namespace: "namespace"
registry_username: ${{ secrets.REGISTRY_LOGIN }}
registry_token: ${{ secrets.REGISTRY_TOKEN }}
dockerfile: "1.20/Dockerfile"
image_name: "container_image-1.20"
tag: "tag"
```
## Multi arch builds
Input `archs` is provided to build the multi architecture images. `archs` input should be comma separated ( i.e. `archs: "amd64, s390x"` ). It is an optional argument, if not provided image will be built on amd64 i.e. default arch
The example below shows how the `sclorg/build-and-push-action` can be used for multi-arch image
```yaml
name: Build and push to quay.io registry
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-20.04
steps:
- name: Build and push to quay.io registry
uses: sclorg/build-and-push-action@v2
with:
registry: "quay.io"
registry_namespace: "namespace"
registry_username: ${{ secrets.REGISTRY_LOGIN }}
registry_token: ${{ secrets.REGISTRY_TOKEN }}
dockerfile: "1.20/Dockerfile"
image_name: "container_image-1.20"
tag: "tag"
archs: "amd64, s390x"
```