Alanny Lopez | edbad28 | 2017-04-24 12:41:27 -0500 | [diff] [blame] | 1 | # Dockerfile for x86_64 Jenkins JNLP Slave Agent Container with Kubectl and Docker Installed |
| 2 | |
| 3 | FROM jenkinsci/jnlp-slave |
| 4 | |
Alanny Lopez | edbad28 | 2017-04-24 12:41:27 -0500 | [diff] [blame] | 5 | USER root |
| 6 | |
| 7 | # Download and install Kubectl |
| 8 | RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s \ |
| 9 | https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl \ |
| 10 | && chmod +x ./kubectl \ |
| 11 | && mv ./kubectl /usr/local/bin/kubectl |
| 12 | |
| 13 | # install Docker and grant access to Jenkins user |
Alanny Lopez | 588edba | 2017-12-28 19:29:35 -0600 | [diff] [blame] | 14 | RUN apt-get update && apt-get install -yy \ |
| 15 | apt-transport-https \ |
| 16 | ca-certificates \ |
| 17 | software-properties-common |
| 18 | |
| 19 | RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" \ |
| 20 | && apt-get update \ |
| 21 | && apt-get install -yy --allow-unauthenticated docker-ce \ |
| 22 | && groupmod --gid 999 docker |
| 23 | |
Alanny Lopez | edbad28 | 2017-04-24 12:41:27 -0500 | [diff] [blame] | 24 | RUN usermod -a -G docker jenkins |
| 25 | |
| 26 | USER jenkins |
| 27 | |
| 28 | ENTRYPOINT ["jenkins-slave"] |