# README for Docker Image Build and Publish Workflows ## Overview This repository contains two GitHub Actions workflows designed for automating the build and publishing of Docker images to an OCI registry. The workflows trigger on specific events in your Git repository, ensuring that your Docker images are always up-to-date with the latest commits and tags. ### Workflows 1. **Build and Publish Docker Image on Commit** - **Trigger:** Activates on commits to the `main` branch, excluding tag pushes. - **Purpose:** Builds and publishes a Docker image for every commit made to the main branch. 2. **Build and Publish Docker Image on Tag** - **Trigger:** Activates when a new tag is pushed to the repository. - **Purpose:** Builds and publishes a Docker image for the specific tag and also tags it as `latest` for easier access. ## Workflow Details ### Build and Publish Docker Image on Commit - **Jobs:** - **Checkout repository:** Clones the repository to the workflow runner. - **Test Docker Connection:** Runs a simple Docker command to verify connectivity. - **Login to OCI Registry:** Authenticates to the OCI registry using stored secrets. - **Build and Push Docker Image:** Builds a Docker image tagged with the commit SHA and pushes it to the registry. ### Build and Publish Docker Image on Tag - **Jobs:** - **Checkout repository:** Clones the repository to the workflow runner. - **Test Docker Connection:** Runs a simple Docker command to verify connectivity. - **Login to OCI Registry:** Authenticates to the OCI registry using stored secrets. - **Build and Push Docker Image:** Builds a Docker image tagged with the Git tag and pushes it to the registry. Additionally, it tags the image as `latest` for easier access. ## Prerequisites - **Secrets Configuration:** Ensure the following secrets are configured in your GitHub repository: - `OCI_TOKEN`: Your OCI registry token. - `OCI_USER`: Your OCI registry username. ## How to Use 1. **Clone the Repository:** Clone this template repository to your local machine. 2. **Modify Dockerfile:** Customize the `Dockerfile` as needed for your application. 3. **Push Changes:** Commit and push your changes to the `main` branch or create a tag to trigger the workflows. 4. **Check Workflow Runs:** Monitor the Actions tab in your GitHub repository to see the progress and logs of your workflow runs. ## Notes - The workflows are designed for use with a Docker builder environment. - Ensure your Docker setup is compatible with multi-platform builds if you plan to use that feature. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.