├── .editorconfig ├── .github ├── actions │ └── build │ │ └── action.yml └── workflows │ └── build.yaml ├── .gitignore ├── .gitpod.Dockerfile ├── .gitpod.yml ├── LICENSE ├── Makefile ├── OWNERS ├── README.md └── base ├── Dockerfile ├── README.md └── podman └── Dockerfile /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.{yml,yaml}] 12 | indent_size = 2 13 | 14 | [*.sh] 15 | indent_size = 2 16 | 17 | [*.md] 18 | trim_trailing_whitespace = false 19 | 20 | [{Makefile,**.mk}] 21 | indent_style = tab 22 | 23 | [Jenkinsfile] 24 | indent_size = 2 25 | -------------------------------------------------------------------------------- /.github/actions/build/action.yml: -------------------------------------------------------------------------------- 1 | name: Build template 2 | description: "Template for docker build." 3 | 4 | inputs: 5 | context: 6 | description: Build context for docker. 7 | required: true 8 | dockerfile: 9 | description: Dockerfile location. 10 | required: true 11 | image-name: 12 | description: Docker image name. 13 | required: true 14 | tag-suffix: 15 | description: Suffix of tag name. 16 | required: true 17 | default: "" 18 | platforms: 19 | description: Builder node platforms available (comma separated). 20 | required: true 21 | default: "linux/amd64" 22 | build-args: 23 | description: List of build-time variables. 24 | required: false 25 | default: "" 26 | docker-registry: 27 | description: Docker registry. 28 | required: false 29 | default: docker.io 30 | docker-namespace: 31 | description: Docker namespace. 32 | required: false 33 | default: "" 34 | docker-password: 35 | description: Password of current docker namespace in docker registry. 36 | required: false 37 | default: "" 38 | ghcr-token: 39 | description: Token of current GitHub account in GitHub container registry. 40 | required: false 41 | default: "" 42 | 43 | runs: 44 | using: composite 45 | steps: 46 | - uses: actions/checkout@v4 47 | - name: Docker meta for KubeSphere 48 | id: meta 49 | uses: docker/metadata-action@v5 50 | with: 51 | images: | 52 | kubesphere/${{ inputs.image-name }} 53 | tags: | 54 | type=ref,event=branch,suffix=${{ inputs.tag-suffix }} 55 | type=ref,event=pr,suffix=${{ inputs.tag-suffix }} 56 | type=semver,pattern={{version}},prefix=v,suffix=${{ inputs.tag-suffix }} 57 | type=raw,value=latest,suffix=${{ inputs.tag-suffix }} 58 | - name: Set up QEMU 59 | uses: docker/setup-qemu-action@v3 60 | - name: Set up Docker Buildx 61 | uses: docker/setup-buildx-action@v3 62 | - name: Login to DockerHub 63 | uses: docker/login-action@v3 64 | with: 65 | registry: ${{ inputs.docker-registry }} 66 | username: ${{ inputs.docker-namespace }} 67 | password: ${{ inputs.docker-password }} 68 | - name: Build and push Docker images 69 | uses: docker/build-push-action@v6 70 | with: 71 | context: ${{ inputs.context }} 72 | file: ${{ inputs.dockerfile }} 73 | tags: ${{ steps.meta.outputs.tags }} 74 | push: ${{ github.event_name != 'pull_request' }} 75 | labels: ${{ steps.meta.outputs.labels }} 76 | platforms: ${{ inputs.platforms }} 77 | build-args: ${{ inputs.build-args }} 78 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: Build Images 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - master 8 | tags: 9 | - 'v*.*.*' 10 | 11 | jobs: 12 | BuildBase: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Build base agent for docker 17 | uses: ./.github/actions/build 18 | with: 19 | context: base 20 | dockerfile: base/Dockerfile 21 | image-name: builder-base 22 | platforms: linux/amd64,linux/arm64 23 | docker-namespace: ${{ secrets.DOCKER_HUB_USER }} 24 | docker-password: ${{ secrets.DOCKER_HUB_SECRETS }} 25 | 26 | - name: Build base agent for podman 27 | uses: ./.github/actions/build 28 | with: 29 | context: base 30 | dockerfile: base/podman/Dockerfile 31 | image-name: builder-base 32 | tag-suffix: -podman 33 | platforms: linux/amd64,linux/arm64 34 | docker-namespace: ${{ secrets.DOCKER_HUB_USER }} 35 | docker-password: ${{ secrets.DOCKER_HUB_SECRETS }} 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Example user template template 3 | ### Example user template 4 | 5 | # IntelliJ project files 6 | .idea 7 | *.iml 8 | out 9 | gen 10 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full 2 | 3 | # More information: https://www.gitpod.io/docs/config-docker/ 4 | RUN sudo rm -rf /usr/bin/hd && \ 5 | brew install linuxsuren/linuxsuren/hd && \ 6 | hd install cli/cli 7 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.Dockerfile 3 | 4 | tasks: 5 | - init: | 6 | [[ ! -z "${DOCKER_USER}" && ! -z "${DOCKER_PASSWD}" ]] && docker login -u${DOCKER_USER} -p${DOCKER_PASSWD} 7 | [[ ! -z "${GITHUB_USER}" && ! -z "${GITHUB_TOKEN}" ]] && docker login ghcr.io -u${GITHUB_USER} -p${GITHUB_TOKEN} 8 | git config --global user.name $GIT_AUTHOR_NAME 9 | git config --global user.email $GIT_COMMITTER_EMAIL 10 | gh repo fork --remote 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | COMMIT := $(shell git rev-parse --short HEAD) 2 | VERSION := dev-$(shell git describe --tags $(shell git rev-list --tags --max-count=1)) 3 | 4 | build-base: 5 | docker buildx build base -f base/Dockerfile -t kubesphere/builder-base:$(VERSION) 6 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | approvers: 2 | - stoneshi-yunify 3 | - renyunkang 4 | - chilianyi 5 | 6 | reviewers: 7 | - rayzhou2017 8 | - benjaminhuo 9 | - calvinyv 10 | - pixiake 11 | - wansir 12 | - zheng1 13 | - stoneshi-yunify 14 | - renyunkang 15 | - chilianyi 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/kubesphere/devops-agent) 2 | 3 | # KubeSphere DevOps Agent 4 | 5 | ## Introduction 6 | 7 | In [KubeSphere](https://kubesphere.io/) DevOps, the pipeline runs on the agent of Jenkins. The agent depends on the [kubernetes-plugin](https://github.com/jenkinsci/kubernetes-plugin). It's necessary to provide Kubernetes a podTemplate, and the podTemplate defines the agent. 8 | 9 | The definition method of podTemplate is: 10 | 11 | ```bash 12 | podTemplate(containers: [ 13 | containerTemplate(name: 'base', image: 'kubesphere/builder-base:latest', ttyEnabled: true, command: 'cat') 14 | ]) 15 | ``` 16 | 17 | This repo stores the build files of image for these podTemplate. 18 | 19 | Welcome to contribute. 20 | 21 | ## Images 22 | Images for both production and development: 23 | 24 | | Name | Introduction | Docker Pulls | 25 | |---------------------------|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| 26 | | `kubesphere/builder-base` | [README](base/README.md) | [![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/builder-base.svg)](https://hub.docker.com/r/kubesphere/builder-base/tags) | 27 | 28 | **NOTE** 29 | 1. The image with tag `x.y.z-podman` has the very same utilities installed compared to the `x.y.z` image, the only difference is that the `x.y.z-podman` image makes a symbolic link of `docker` to `podman`, for easy use and backward compatibility. 30 | 31 | ## Legacy Images 32 | Legacy images built on centos:7 are no longer developed but may be still working. 33 | 34 | For production: 35 | 36 | | Name | Docker Pulls | 37 | |---|---| 38 | | `kubesphere/builder-go` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/builder-go.svg)](https://hub.docker.com/r/kubesphere/builder-go/tags) | 39 | | `kubesphere/builder-maven` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/builder-maven.svg)](https://hub.docker.com/r/kubesphere/builder-maven/tags) | 40 | | `kubesphere/builder-gradle` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/builder-gradle.svg)](https://hub.docker.com/r/kubesphere/builder-gradle/tags) | 41 | | `kubesphere/builder-nodejs` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/builder-nodejs.svg)](https://hub.docker.com/r/kubesphere/builder-nodejs/tags) | 42 | | `kubesphere/builder-dotnet` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/builder-dotnet.svg)](https://hub.docker.com/r/kubesphere/builder-dotnet/tags) | 43 | | `kubesphere/builder-python` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/builder-python.svg)](https://hub.docker.com/r/kubesphere/builder-python/tags) | 44 | 45 | For development: 46 | 47 | | Name | Docker Pulls | 48 | |---|---| 49 | | `kubespheredev/builder-go` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubespheredev/builder-go.svg)](https://hub.docker.com/r/kubespheredev/builder-go/tags) | 50 | | `kubespheredev/builder-maven` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubespheredev/builder-maven.svg)](https://hub.docker.com/r/kubespheredev/builder-maven/tags) | 51 | | `kubespheredev/builder-gradle` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubespheredev/builder-gradle.svg)](https://hub.docker.com/r/kubespheredev/builder-gradle/tags) | 52 | | `kubespheredev/builder-nodejs` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubespheredev/builder-nodejs.svg)](https://hub.docker.com/r/kubespheredev/builder-nodejs/tags) | 53 | | `kubespheredev/builder-dotnet` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubespheredev/builder-dotnet.svg)](https://hub.docker.com/r/kubespheredev/builder-dotnet/tags) | 54 | | `kubespheredev/builder-python` | [![Docker Pulls](https://img.shields.io/docker/pulls/kubespheredev/builder-python.svg)](https://hub.docker.com/r/kubespheredev/builder-python/tags) | 55 | 56 | ## How to Build 57 | Check out the Makefile. 58 | 59 | For example, build the base image: 60 | 61 | ```bash 62 | make build-base 63 | ``` 64 | 65 | ## Join & Contact Community 66 | 67 | - Slack [#sig-devops](https://kubesphere.slack.com/messages/sig-devops) 68 | - [Twitter](https://twitter.com/KubeSphere) 69 | - Mailing list [archive](https://groups.google.com/group/kubesphere-sig-devops/topics) | [subscribe](mailto:kubesphere-sig-devops+subscribe@googlegroups.com) | [unsubscribe](mailto:kubesphere-sig-devops+unsubscribe@googlegroups.com) 70 | - [Medium (Blog)](https://itnext.io/@kubesphere) 71 | 72 | -------------------------------------------------------------------------------- /base/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 2 | 3 | ARG TARGETARCH 4 | 5 | # Set working directory 6 | WORKDIR /root 7 | 8 | ENV JENKINS_HOME /home/jenkins 9 | 10 | # Install utils 11 | RUN apt-get update && \ 12 | apt-get install -y --no-install-recommends \ 13 | ca-certificates \ 14 | git \ 15 | curl \ 16 | perl \ 17 | openssl \ 18 | gnupg \ 19 | unzip \ 20 | make \ 21 | wget \ 22 | zip \ 23 | bzip2 \ 24 | vim \ 25 | jq \ 26 | yq \ 27 | gcc \ 28 | g++ \ 29 | libcurl4-openssl-dev \ 30 | build-essential \ 31 | autoconf \ 32 | libexpat1-dev \ 33 | gettext \ 34 | libssl-dev \ 35 | libperl-dev \ 36 | zlib1g-dev \ 37 | python3 \ 38 | python3-pip \ 39 | podman \ 40 | software-properties-common \ 41 | apt-transport-https \ 42 | fuse-overlayfs \ 43 | openjdk-21-jdk 44 | 45 | ## Settings for Java 46 | ENV JDK_HOME=/usr/lib/jvm/java-21-openjdk-${TARGETARCH} 47 | ENV JAVA_HOME=$JDK_HOME 48 | ENV PATH=$PATH:${JAVA_HOME}/bin 49 | 50 | # Settings for python 51 | RUN ln -fs $(which python3) /usr/bin/python && ln -fs $(which pip3) /usr/bin/pip 52 | 53 | # Install docker CLI 54 | RUN install -m 0755 -d /etc/apt/keyrings && \ 55 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \ 56 | chmod a+r /etc/apt/keyrings/docker.asc && \ 57 | echo \ 58 | "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ 59 | $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ 60 | tee /etc/apt/sources.list.d/docker.list > /dev/null && \ 61 | apt-get update && \ 62 | apt-get install -y docker-ce-cli docker-buildx-plugin docker-compose-plugin 63 | 64 | # Install helm 65 | RUN curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null && \ 66 | apt-get install apt-transport-https --yes && \ 67 | echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list && \ 68 | apt-get update && \ 69 | apt-get install -y helm 70 | 71 | # Install kubectl 72 | RUN curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \ 73 | chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \ 74 | echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list && \ 75 | chmod 644 /etc/apt/sources.list.d/kubernetes.list && \ 76 | apt-get update && \ 77 | apt-get install -y kubectl 78 | 79 | # Install kustomize 80 | RUN cd /usr/local/bin && curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash 81 | 82 | # Install Sonar Scanner CLI 83 | ENV SONAR_SCANNER_VERSION=7.0.2.4839 84 | RUN arch=$(dpkg --print-architecture) && \ 85 | if [ $arch = "amd64" ]; then \ 86 | TARGET_ARCH=linux-x64; \ 87 | elif [ $arch = "arm64" ]; then \ 88 | TARGET_ARCH=linux-aarch64; \ 89 | else \ 90 | echo "Unsupported architecture: $arch" && exit 1; \ 91 | fi && \ 92 | wget -O sonar_scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-${TARGET_ARCH}.zip && \ 93 | unzip sonar_scanner.zip -d /opt && \ 94 | rm sonar_scanner.zip && \ 95 | mv /opt/sonar-scanner-${SONAR_SCANNER_VERSION}-${TARGET_ARCH} /opt/sonar-scanner && \ 96 | ln -fs /opt/sonar-scanner/bin/sonar-scanner /usr/local/bin/sonar-scanner 97 | 98 | # Install ks (Kubesphere CLI) 99 | RUN curl -fL https://github.com/kubesphere-sigs/ks/releases/download/v0.0.73/ks-linux-$(dpkg --print-architecture).tar.gz | tar xzv && \ 100 | mv ks /usr/local/bin/ 101 | 102 | # Install golang 103 | ENV GOVERSION=1.24 104 | ENV GOROOT=/usr/lib/go-${GOVERSION} 105 | ENV GOPATH=$JENKINS_HOME/go 106 | ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin 107 | RUN mkdir -p $GOPATH/bin && mkdir -p $GOPATH/src && mkdir -p $GOPATH/pkg 108 | RUN add-apt-repository -y ppa:longsleep/golang-backports && \ 109 | apt-get update && \ 110 | apt-get install -y golang-${GOVERSION}-go 111 | 112 | RUN go env -w GOPATH=$JENKINS_HOME/go 113 | 114 | # Install sdkman 115 | RUN curl -s "https://get.sdkman.io" | bash 116 | 117 | # Install gradle 118 | ENV GRADLE_VERSION=8.14 119 | RUN bash -c "source /root/.sdkman/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION}" 120 | 121 | RUN ln -fs /root/.sdkman/candidates/gradle/current/bin/gradle /usr/local/bin/gradle 122 | 123 | # Install Maven 124 | ENV MAVEN_VERSION=3.9.9 125 | RUN curl -f -L https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz | tar -C /opt -xzv && \ 126 | mv /opt/apache-maven-${MAVEN_VERSION} /opt/apache-maven 127 | ENV M2_HOME=/opt/apache-maven 128 | ENV maven.home=$M2_HOME 129 | ENV M2=$M2_HOME/bin 130 | ENV PATH=$PATH:$M2 131 | 132 | # Install ant 133 | ENV ANT_VERSION=1.10.15 134 | RUN wget -q https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ 135 | tar -xzf apache-ant-${ANT_VERSION}-bin.tar.gz && \ 136 | mv apache-ant-${ANT_VERSION} /opt/ant && \ 137 | rm apache-ant-${ANT_VERSION}-bin.tar.gz 138 | ENV ANT_HOME=/opt/ant 139 | ENV PATH=${PATH}:${ANT_HOME}/bin 140 | 141 | # Set up NodeSource repository for Node.js 142 | RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - 143 | 144 | # Install Node.js 145 | RUN apt-get install -y nodejs 146 | 147 | # Install Yarn and other packages 148 | RUN npm install --global --force yarn watch-cli typescript 149 | 150 | # Clean up 151 | RUN apt-get clean && \ 152 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 153 | 154 | # Set working directory 155 | WORKDIR /home/jenkins 156 | 157 | # Default command 158 | ENTRYPOINT ["/bin/bash"] -------------------------------------------------------------------------------- /base/README.md: -------------------------------------------------------------------------------- 1 | Base image with latest common sdks and utilities built with ubuntu, include: 2 | - docker cli 3 | - podman 4 | - kubectl 5 | - kustomize 6 | - helm 7 | - jdk 8 | - gradle 9 | - sonar-scanner 10 | - python 11 | - maven 12 | - ant 13 | - go 14 | - nodejs 15 | - yarn 16 | - npm 17 | - ks 18 | - ... 19 | 20 | -------------------------------------------------------------------------------- /base/podman/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM kubesphere/builder-base:latest 2 | RUN ln -s -f /usr/bin/podman /usr/bin/docker 3 | --------------------------------------------------------------------------------