Last active
August 12, 2022 20:12
-
-
Save Vijaydaswani/97cc3b7224d8fbebc60df26c40a23a69 to your computer and use it in GitHub Desktop.
Install packages in Jenkins slave container to execute stages in container.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM jenkins/slave | |
# File Author / Maintainer | |
MAINTAINER Vijay Daswani | |
ENV KUBECTL_VERSION=v1.18.0 | |
USER root | |
RUN apt-get update -y | |
RUN apt-get install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg-agent \ | |
software-properties-common -y | |
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
RUN apt install docker.io -y | |
# Install kubectl | |
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl \ | |
&& chmod +x ./kubectl \ | |
&& mv ./kubectl /usr/local/bin/kubectl | |
COPY config /home/jenkins/.kube/config | |
COPY jenkins-agent /usr/local/bin/jenkins-agent | |
RUN chmod +x /usr/local/bin/jenkins-agent &&\ | |
ln -s /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-slave | |
USER jenkins | |
ENTRYPOINT ["jenkins-agent"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment