How to Build & Push Docker Images Using GitHub Composite Actions | Build Github Action

Опубликовано: 23 Июль 2026
на канале: MahinOPS
361
20

This composite GitHub Action automates the process of building and pushing Docker images to a DockerHub repository. It accepts inputs such as DockerHub username, access token, image name, image tag, and Dockerfile path, and performs the following steps:

Authentication: Logs into DockerHub using the provided credentials.
Build: Builds the Docker image based on the specified image name, tag, and Dockerfile path.
Push: Pushes the built image to the DockerHub repository.
The image naming format follows username/image-name:tag. The action outputs the final result, indicating whether the process succeeded or failed (login failure, build failure, or push failure).

Input Fields:

dockerhub-username: DockerHub username.
dockerhub-access-token: DockerHub access token for authentication.
image-name: Name of the Docker image.
image-tag: Tag for the Docker image.
dockerfile-path: Path to the Dockerfile used for building the image.
Output Fields:

result: Final outcome of the process (e.g., success, login fail, build fail, push fail).

Github Repo Link: https://github.com/mokhlesurr031/gh-t...