mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-04-20 09:01:23 +00:00
Add workflow, link checker and modify Readme (#30)
* Add test workflow for dockerfile build * Add link checker workflow * Modify Readme to divide input for build strategies Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
parent
e56c3269a5
commit
21e07c3197
4 changed files with 91 additions and 115 deletions
45
.github/workflows/dockerfile_build.yml
vendored
Normal file
45
.github/workflows/dockerfile_build.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# This workflow will perform a test whenever there
|
||||||
|
# is some change in code done to ensure that the changes
|
||||||
|
# are not buggy and we are getting the desired output.
|
||||||
|
name: Build from dockerfile
|
||||||
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "hello-world"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build image using Buildah
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
|
||||||
|
# Checkout buildah action github repository
|
||||||
|
- name: Checkout Buildah action
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: "buildah-build"
|
||||||
|
|
||||||
|
- name: Create Dockerfile
|
||||||
|
run: |
|
||||||
|
cat > Dockerfile<<EOF
|
||||||
|
FROM busybox
|
||||||
|
RUN echo "hello world"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Build image using Buildah action
|
||||||
|
- name: Build Image
|
||||||
|
id: build_image
|
||||||
|
uses: ./buildah-build/
|
||||||
|
with:
|
||||||
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
tags: 'latest ${{ github.sha }}'
|
||||||
|
dockerfiles: |
|
||||||
|
./Dockerfile
|
||||||
|
|
||||||
|
- name: Echo Outputs
|
||||||
|
run: |
|
||||||
|
echo "Image: ${{ steps.build_image.outputs.image }}"
|
||||||
|
echo "Tags: ${{ steps.build_image.outputs.tags }}"
|
||||||
|
|
||||||
|
# Check if image is build
|
||||||
|
- name: Check images created
|
||||||
|
run: buildah images | grep '${{ env.IMAGE_NAME }}'
|
18
.github/workflows/link_check.yml
vendored
Normal file
18
.github/workflows/link_check.yml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
name: Link checker
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
-'**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
markdown-link-check:
|
||||||
|
name: Check links in markdown
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: gaurav-nelson/github-action-markdown-link-check@v1
|
||||||
|
with:
|
||||||
|
use-verbose-mode: true
|
|
@ -1,7 +1,7 @@
|
||||||
# This workflow will perform a test whenever there
|
# This workflow will perform a test whenever there
|
||||||
# is some change in code done to ensure that the changes
|
# is some change in code done to ensure that the changes
|
||||||
# are not buggy and we are getting the desired output.
|
# are not buggy and we are getting the desired output.
|
||||||
name: Test Build
|
name: Build
|
||||||
on: [push, pull_request, workflow_dispatch]
|
on: [push, pull_request, workflow_dispatch]
|
||||||
env:
|
env:
|
||||||
PROJECT_DIR: spring-petclinic
|
PROJECT_DIR: spring-petclinic
|
||||||
|
@ -11,7 +11,7 @@ env:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build image using Buildah
|
name: Build image using Buildah
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# Checkout buildah action github repository
|
# Checkout buildah action github repository
|
139
README.md
139
README.md
|
@ -1,6 +1,8 @@
|
||||||
# buildah-build
|
# buildah-build
|
||||||
[](https://github.com/redhat-actions/buildah-build/actions?query=workflow%3A%22CI+checks%22)
|
[](https://github.com/redhat-actions/buildah-build/actions?query=workflow%3A%22CI+checks%22)
|
||||||
[](https://github.com/redhat-actions/buildah-build/actions?query=workflow%3A%22Test+Build%22)
|
[](https://github.com/redhat-actions/buildah-build/actions?query=workflow%3ABuild)
|
||||||
|
[](https://github.com/redhat-actions/buildah-build/actions?query=workflow%3A%22Build+from+dockerfile%22)
|
||||||
|
[](https://github.com/redhat-actions/buildah-build/actions?query=workflow%3A%22Link+checker%22)
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
[](https://github.com/redhat-actions/buildah-build/tags)
|
[](https://github.com/redhat-actions/buildah-build/tags)
|
||||||
|
@ -15,108 +17,31 @@ After building your image, use [push-to-registry](https://github.com/redhat-acti
|
||||||
|
|
||||||
## Action Inputs
|
## Action Inputs
|
||||||
|
|
||||||
<table>
|
### Inputs for build from dockerfile
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Input</th>
|
|
||||||
<th>Required</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
| Input Name | Description | Default |
|
||||||
<td>image</td>
|
| ---------- | ----------- | ------- |
|
||||||
<td>Yes</td>
|
| build-args | Build arguments to pass to the Docker build using `--build-arg`, if using a Dockerfile that requires ARGs. Use the form `arg_name=arg_value`, and separate arguments with newlines. | None
|
||||||
<td>Name to give the output image.</td>
|
| context | Path to directory to use as the build context. | `.`
|
||||||
</tr>
|
| dockerfiles | The list of Dockerfile paths to perform a build using docker instructions. This is a multiline input to allow multiple Dockerfiles. | **Must be provided**
|
||||||
|
| image | Name to give to the output image. | **Must be provided**
|
||||||
|
| oci | Build the image using the OCI format, instead of the Docker format. By default, this is `false`, because images built using the OCI format have issues when published to Dockerhub. | `false`
|
||||||
|
| tags | The tags of the image to build. For multiple tags, separate by a space. For example, `latest ${{ github.sha }}` | `latest`
|
||||||
|
|
||||||
<tr>
|
### Inputs for build without dockerfile
|
||||||
<td>tags</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>
|
|
||||||
The tags of the image to build. For multiple tags, separate by a space. For example, <code>latest ${{ github.sha }}</code>.<br>
|
|
||||||
Default: <code>latest</code>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
| Input Name | Description | Default |
|
||||||
<td>base-image</td>
|
| ---------- | ----------- | ------- |
|
||||||
<td>No</td>
|
| base-image | The base image to use for the container. | **Must be provided**
|
||||||
<td>The base image to use for the container.</td>
|
| content | Paths to files or directories to copy inside the container to create the file image. This is a multiline input to allow you to copy multiple files/directories.| None
|
||||||
</tr>
|
| context | Path to directory to use as the build context. | `.`
|
||||||
|
| entrypoint | The entry point to set for the container. This is a multiline input; split arguments across lines. | None
|
||||||
<tr>
|
| envs | The environment variables to be set when running the container. This is a multiline input to add multiple environment variables. | None
|
||||||
<td>dockerfiles</td>
|
| image | Name to give to the output image. | **Must be provided**
|
||||||
<td>No</td>
|
| oci | Build the image using the OCI format, instead of the Docker format. By default, this is `false`, because images built using the OCI format have issues when published to Dockerhub. | `false`
|
||||||
<td>The list of Dockerfile paths to perform a build using docker instructions. This is a multiline input to allow multiple Dockerfiles.
|
| port | The port to expose when running the container. | None
|
||||||
</td>
|
| tags | The tags of the image to build. For multiple tags, separate by a space. For example, `latest ${{ github.sha }}` | `latest`
|
||||||
</tr>
|
| workdir | The working directory to use within the container. | None
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>oci</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>
|
|
||||||
Build the image using the OCI format, instead of the Docker format.<br>
|
|
||||||
By default, this is <code>false</code>, because images built using the OCI format have <a href="https://github.com/docker/hub-feedback/issues/1871">issues</a> when published to Dockerhub.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>context</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>Path to directory to use as the build context.<br>
|
|
||||||
Default: <code>.</code></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>build-args</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>Build arguments to pass to the Docker build using <code>--build-arg</code>, if using a Dockerfile that requires ARGs.<br>
|
|
||||||
Uses the form <code>arg_name=arg_value</code>, and separate arguments with newlines.</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>content</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>The content to copy inside the container to create the final image. This is a multiline input to allow you to copy more than one file/directory.<br>
|
|
||||||
<pre>content: |
|
|
||||||
target/spring-petclinic-2.3.0.BUILD-SNAPSHOT.jar</pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>entrypoint</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>The entry point to set for the container. This is a multiline input; split arguments across lines.
|
|
||||||
<pre>entrypoint: |
|
|
||||||
java
|
|
||||||
-jar
|
|
||||||
spring-petclinic-2.3.0.BUILD-SNAPSHOT.jar</pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>port</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>The port to expose when running the container.</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>workdir</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>The working directory to use within the container.</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>envs</td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>The environment variables to be set when running the container. This is a multiline input to add multiple environment variables.<br>
|
|
||||||
<pre>
|
|
||||||
envs: |
|
|
||||||
GOPATH=/root/buildah/go</pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
## Action Outputs
|
## Action Outputs
|
||||||
|
|
||||||
|
@ -181,7 +106,7 @@ on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-image:
|
build-image:
|
||||||
name: Build image
|
name: Build image without Dockerfile
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -209,15 +134,3 @@ For example:
|
||||||
- name: Log in to Red Hat Registry
|
- name: Log in to Red Hat Registry
|
||||||
run: echo "${{ secrets.REGISTRY_REDHAT_IO_PASSWORD }}" | docker login registry.redhat.io -u "${{ secrets.REGISTRY_REDHAT_IO_USER }}" --password-stdin
|
run: echo "${{ secrets.REGISTRY_REDHAT_IO_PASSWORD }}" | docker login registry.redhat.io -u "${{ secrets.REGISTRY_REDHAT_IO_USER }}" --password-stdin
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
This is an open source project open to anyone. This project welcomes contributions and suggestions!
|
|
||||||
|
|
||||||
## Feedback & Questions
|
|
||||||
|
|
||||||
If you discover an issue please file a bug in [GitHub issues](https://github.com/redhat-actions/buildah/issues) and we will fix it as soon as possible.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT, See [LICENSE](https://github.com/redhat-actions/buildah/blob/main/LICENSE.md) for more information.
|
|
||||||
|
|
Loading…
Reference in a new issue