Skip to content

Commit f68fb7d

Browse files
authored
feat: Add Docker build and push workflows for Docker Hub and JFrog Artifactory (#59)
* feat: Add Docker build and push workflows for Docker Hub and JFrog Artifactory - Introduced two new workflows: `docker-build-push-dockerhub.yaml` and `docker-build-push-jfrog.yaml` for building and publishing Docker images to Docker Hub and JFrog Artifactory, respectively. - Each workflow includes customizable inputs for repository name, image name, build context, platforms, and secret management, enhancing flexibility in Docker image publishing. - Implemented environment variable setups and login steps for both Docker Hub and JFrog, ensuring secure and efficient image publishing processes. This update significantly expands the capabilities of the Docker publishing workflows, allowing for tailored configurations based on user needs. * feat: Add example for Docker image workflows - Introduced new workflows: `docker-promote-dockerhub.yaml` and `docker-promote-jfrog.yaml` for promoting Docker images between repositories. - Each workflow supports customizable inputs for source and target repository names, image names, and tags, enhancing flexibility in image promotion. - Implemented environment variable setups, secure login steps, and image attestation processes to ensure efficient and secure promotions. This update expands the capabilities of the Docker promotion workflows, allowing for tailored configurations based on user needs. * chore: Remove deprecated GitHub Actions workflows - Deleted obsolete workflows: `docker-build-and-push`, `get-group-topic`, `jfrog-build-publish`, `pipeline-ci-build-and-push-image`, and `pipeline-cd-promote-image`. - Updated `docker-build-push.yaml` and `publish-docker.yaml` to indicate deprecation and direct users to new workflows for Docker image promotion and publishing. This cleanup enhances the clarity and maintainability of the workflow directory by removing outdated configurations. * chore: Update copyright year in LICENSE and README files - Changed copyright year from 2024 to 2025 in both `LICENSE` and `README.md` files to reflect the current year. - Ensured consistency in copyright information across documentation. This update maintains accurate legal information in the repository's documentation. * docs: Update README to enhance Docker workflows documentation - Revised sections for building and publishing Docker images to JFrog Artifactory and Docker Hub, providing clearer implementation details and examples. - Consolidated features and processes for Docker image promotion workflows, ensuring comprehensive coverage of functionalities. - Improved organization of the README to facilitate better understanding of available workflows and their configurations. This update enhances the clarity and usability of the documentation for users working with Docker workflows in the repository. * chore: Mark promote-docker.yaml as deprecated - Added a deprecation notice to `promote-docker.yaml`, directing users to use `docker-promote-jfrog.yaml` or `docker-promote-dockerhub.yaml` instead. - This change helps streamline the workflow directory by guiding users towards the current recommended practices for Docker image promotion. This update enhances clarity regarding the status of the workflow and encourages the adoption of newer alternatives. * feat: Enhance docker-promote-jfrog.yaml with source environment input - Added a new optional input `source_env` to specify the source environment for promotion, allowing for more flexible configurations. - Implemented validation to ensure `source_env` accepts only valid values ('dev', 'staging', or 'none'). - Updated the logic for setting the `SOURCE_ENV` variable based on the new input, improving the workflow's adaptability. This update enhances the functionality of the Docker promotion workflow by allowing users to define the source environment explicitly. * docs: Revise README and add examples for Docker image workflows - Removed outdated sections from the main README and consolidated Docker image workflows documentation into a new `examples/docker/README.md` file. - Enhanced clarity by providing detailed implementation and example links for building and publishing Docker images to JFrog Artifactory and Docker Hub. - Included environment flow details for both JFrog Artifactory and Docker Hub, improving user understanding of the promotion paths and repository structures. This update improves the organization and usability of the documentation for Docker workflows, making it easier for users to navigate and implement the workflows effectively. * docs: Update README to clarify workflow naming conventions - Added a section to the README outlining the naming convention for workflows, specifying the format as `technology-action-flavor.yaml`. - Provided an example to illustrate the naming structure, enhancing user understanding of workflow organization. This update improves the documentation by making it easier for users to comprehend the naming conventions used in the repository.
1 parent 2b30c60 commit f68fb7d

25 files changed

+681
-574
lines changed

.github/actions/docker-build-and-push/action.yaml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/actions/get-group-topic/action.yaml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/actions/jfrog-build-publish/action.yaml

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
repo_name:
5+
description: "Name of the repository to publish to"
6+
type: string
7+
required: false
8+
default: "nethermindeth"
9+
image_name:
10+
description: "Name of the image to publish. Defaults to the repository name."
11+
type: string
12+
required: false
13+
default: "${{ github.event.repository.name }}"
14+
push:
15+
description: "Whether or not to push to Artifactory"
16+
type: boolean
17+
default: true
18+
required: false
19+
context:
20+
description: "Build's context is the set of files located in the specified PATH or URL"
21+
type: string
22+
default: "."
23+
required: false
24+
platforms:
25+
description: "Platforms to build for (comma-separated)"
26+
type: string
27+
default: "linux/amd64,linux/arm64"
28+
required: false
29+
setup-qemu:
30+
description: "Set up QEMU"
31+
type: boolean
32+
default: false
33+
required: false
34+
dockerfile_path:
35+
description: "Path to Dockerfile"
36+
type: string
37+
default: "Dockerfile"
38+
required: false
39+
additional_tags:
40+
description: "Additional tags to apply (comma-separated)"
41+
type: string
42+
default: ""
43+
required: false
44+
docker_secrets:
45+
description: "List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)"
46+
type: string
47+
required: false
48+
docker_secret_envs:
49+
description: "List of secret env vars to expose to the build (e.g., key=envname, MY_SECRET=MY_ENV_VAR)"
50+
required: false
51+
type: string
52+
docker_secret_files:
53+
description: "List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)"
54+
required: false
55+
type: string
56+
docker_ulimit:
57+
description: "Ulimit options (e.g., nofile=1024:1024)"
58+
required: false
59+
type: string
60+
docker_build_args:
61+
description: "List of build-time variables"
62+
required: false
63+
type: string
64+
secrets:
65+
dockerhub_username:
66+
description: "Docker Hub username"
67+
required: true
68+
dockerhub_password:
69+
description: "Docker Hub password"
70+
required: true
71+
72+
permissions:
73+
id-token: write
74+
attestations: write
75+
contents: read
76+
77+
jobs:
78+
publish:
79+
name: Build and publish Docker image
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
84+
85+
- name: Login to Docker Hub
86+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
87+
with:
88+
username: ${{ secrets.dockerhub_username }}
89+
password: ${{ secrets.dockerhub_password }}
90+
91+
- name: Build and push
92+
uses: NethermindEth/github-action-image-build-and-push@9d4a91878e15e6014e3d1f463999e169cadca825
93+
with:
94+
registry: "dockerhub"
95+
image_name: ${{ inputs.repo_name }}/${{ inputs.image_name }}
96+
image_tags: ${{ inputs.additional_tags }}
97+
push-to-registry: ${{ inputs.push }}
98+
platforms: ${{ inputs.platforms }}
99+
context: ${{ inputs.context }}
100+
dockerfile_path: ${{ inputs.dockerfile_path }}
101+
setup-qemu: ${{ inputs.setup-qemu }}
102+
secrets: ${{ inputs.docker_secrets }}
103+
secret-envs: ${{ inputs.docker_secret_envs }}
104+
secret-files: ${{ inputs.docker_secret_files }}
105+
ulimit: ${{ inputs.docker_ulimit }}
106+
build-args: ${{ inputs.docker_build_args }}

0 commit comments

Comments
 (0)