feat(jenkins): Add custom Dockerfile with Docker CLI and kubectl
This commit is contained in:
41
apps/jenkins/Dockerfile
Normal file
41
apps/jenkins/Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
||||
FROM jenkins/jenkins:lts-jdk17
|
||||
|
||||
USER root
|
||||
|
||||
# Install Docker CLI
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release && \
|
||||
mkdir -p /etc/apt/keyrings && \
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
|
||||
apt-get update && \
|
||||
apt-get install -y docker-ce-cli && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install kubectl
|
||||
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
|
||||
chmod +x kubectl && \
|
||||
mv kubectl /usr/local/bin/
|
||||
|
||||
# Install git (if not already)
|
||||
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
USER jenkins
|
||||
|
||||
# Pre-install useful plugins
|
||||
RUN jenkins-plugin-cli --plugins \
|
||||
git \
|
||||
docker-workflow \
|
||||
pipeline-stage-view \
|
||||
kubernetes \
|
||||
configuration-as-code \
|
||||
job-dsl \
|
||||
workflow-aggregator \
|
||||
gitea
|
||||
Reference in New Issue
Block a user