Last active
March 27, 2019 23:01
-
-
Save aj07mm/9ec82203d45c990e9d8f909109fd8188 to your computer and use it in GitHub Desktop.
jenkins-docker
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
- docker-compose.yml | |
jenkins: | |
build: . | |
restart: always | |
ports: | |
- "8080:8080" | |
- "5000:5000" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- Dockerfile | |
FROM jenkins/jenkins:2.73.2 | |
# install docker, docker-compose, docker-machine | |
# see: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ | |
# see: https://docs.docker.com/engine/installation/linux/linux-postinstall/ | |
# see: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/ | |
USER root | |
# prerequisites for docker | |
RUN apt-get update \ | |
&& apt-get -y install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
# docker repos | |
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ | |
&& echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" >> /etc/apt/sources.list.d/additional-repositories.list \ | |
&& echo "deb http://ftp-stud.hs-esslingen.de/ubuntu xenial main restricted universe multiverse" >> /etc/apt/sources.list.d/official-package-repositories.list \ | |
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 437D05B5 \ | |
&& apt-get update | |
# docker | |
RUN apt-get -y install docker-ce | |
# docker-compose | |
RUN curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose \ | |
&& chmod +x /usr/local/bin/docker-compose | |
# give jenkins docker rights | |
RUN usermod -aG docker jenkins | |
USER jenkins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment