Skip to content

Instantly share code, notes, and snippets.

@Vijaydaswani
Last active August 12, 2022 20:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Vijaydaswani/97cc3b7224d8fbebc60df26c40a23a69 to your computer and use it in GitHub Desktop.
Save Vijaydaswani/97cc3b7224d8fbebc60df26c40a23a69 to your computer and use it in GitHub Desktop.
Install packages in Jenkins slave container to execute stages in container.
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