添加 CloudNative/Kubernetes/Docs/cicd/jenkins/jnlp-Dockerfile-latest.md
This commit is contained in:
parent
d3aeb3e43e
commit
8370ccee82
1 changed files with 28 additions and 0 deletions
|
@ -0,0 +1,28 @@
|
||||||
|
**要点**
|
||||||
|
```txt
|
||||||
|
1. 下载匹配的kubectl
|
||||||
|
2. 下载合适的docker客户端
|
||||||
|
3. jenkins用户添加sudo附加组,且免密执行命令(注意:执行docker相关命令,需要sudo)
|
||||||
|
4. docker及k8s登录配置文件,在jenkins-server中配置[Secret file]类型的凭证,使用时,加载即可。
|
||||||
|
```
|
||||||
|
```shell
|
||||||
|
cat > Dockerfile << EOF
|
||||||
|
FROM jenkins/inbound-agent:jdk17
|
||||||
|
# root
|
||||||
|
USER root
|
||||||
|
RUN curl -LO "https://dl.k8s.io/release/v1.25.1/bin/linux/amd64/kubectl" && \
|
||||||
|
curl -LO "https://download.docker.com/linux/static/stable/x86_64/docker-24.0.6.tgz" && \
|
||||||
|
tar -xf docker-24.0.6.tgz && \
|
||||||
|
mv kubectl /usr/bin/ && \
|
||||||
|
cp docker/docker /usr/bin/docker && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y sudo && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf docker-24.0.6.tgz docker && \
|
||||||
|
chmod +x /usr/bin/kubectl /usr/bin/docker && \
|
||||||
|
usermod -aG sudo jenkins && \
|
||||||
|
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
|
|
||||||
|
# jenkins
|
||||||
|
USER jenkins
|
||||||
|
```
|
Loading…
Add table
Add a link
Reference in a new issue