From 21e07c31975dd1364240aa8524269fdb81ee9f62 Mon Sep 17 00:00:00 2001 From: Divyanshu Agrawal Date: Wed, 17 Feb 2021 19:23:51 +0530 Subject: [PATCH] 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 --- .github/workflows/dockerfile_build.yml | 45 ++++++ .github/workflows/link_check.yml | 18 +++ .../{verify-build.yml => scratch_build.yml} | 4 +- README.md | 139 ++++-------------- 4 files changed, 91 insertions(+), 115 deletions(-) create mode 100644 .github/workflows/dockerfile_build.yml create mode 100644 .github/workflows/link_check.yml rename .github/workflows/{verify-build.yml => scratch_build.yml} (98%) diff --git a/.github/workflows/dockerfile_build.yml b/.github/workflows/dockerfile_build.yml new file mode 100644 index 0000000..91e7a0a --- /dev/null +++ b/.github/workflows/dockerfile_build.yml @@ -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<
[![tag badge](https://img.shields.io/github/v/tag/redhat-actions/buildah-build)](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 - - - - - - - - +### Inputs for build from dockerfile - - - - - +| Input Name | Description | Default | +| ---------- | ----------- | ------- | +| 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 +| context | Path to directory to use as the build context. | `.` +| 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` - - - - - +### Inputs for build without dockerfile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputRequiredDescription
imageYesName to give the output image.
tagsNo - The tags of the image to build. For multiple tags, separate by a space. For example, latest ${{ github.sha }}.
- Default: latest -
base-imageNoThe base image to use for the container.
dockerfilesNoThe list of Dockerfile paths to perform a build using docker instructions. This is a multiline input to allow multiple Dockerfiles. -
ociNo - 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. -
contextNoPath to directory to use as the build context.
- Default: .
build-argsNoBuild arguments to pass to the Docker build using --build-arg, if using a Dockerfile that requires ARGs.
- Uses the form arg_name=arg_value, and separate arguments with newlines.
contentNoThe 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.
-
content: |
-  target/spring-petclinic-2.3.0.BUILD-SNAPSHOT.jar
-
entrypointNoThe entry point to set for the container. This is a multiline input; split arguments across lines. -
entrypoint: |
-  java
-  -jar
-  spring-petclinic-2.3.0.BUILD-SNAPSHOT.jar
-
portNoThe port to expose when running the container.
workdirNoThe working directory to use within the container.
envsNoThe environment variables to be set when running the container. This is a multiline input to add multiple environment variables.
-
-envs: |
-  GOPATH=/root/buildah/go
-
+| Input Name | Description | Default | +| ---------- | ----------- | ------- | +| base-image | The base image to use for the container. | **Must be provided** +| 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 +| 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 +| envs | The environment variables to be set when running the container. This is a multiline input to add multiple environment variables. | None +| 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` +| port | The port to expose when running the container. | None +| tags | The tags of the image to build. For multiple tags, separate by a space. For example, `latest ${{ github.sha }}` | `latest` +| workdir | The working directory to use within the container. | None ## Action Outputs @@ -181,7 +106,7 @@ on: [push] jobs: build-image: - name: Build image + name: Build image without Dockerfile runs-on: ubuntu-latest steps: @@ -209,15 +134,3 @@ For example: - 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 ``` - -## 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.