diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Dockerfile | 23 | ||||
-rw-r--r-- | Makefile | 17 | ||||
-rw-r--r-- | docker-compose.yml | 16 | ||||
-rw-r--r-- | jenkins_home/.gitkeep | 0 |
5 files changed, 58 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..30ac96b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +jenkins_home/* +!jenkins_home/.gitkeep diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f20433e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM jenkins/jenkins:lts + +USER root + +RUN apt-get update && apt-get -y install \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common && \ + curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \ + add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ + $(lsb_release -cs) \ + stable" && \ + apt-get update && \ + apt-get -y install docker-ce + +RUN apt-get install -y docker-ce + +RUN usermod -a -G docker jenkins + +USER jenkins diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d5d2099 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +build: ## Build the Docker image + docker-compose -p jenkins_docker build + +up: build ## Bring the container up + docker-compose -p jenkins_docker up -d + +down: ## Stop the container + docker-compose -p jenkins_docker stop + +enter: ## Enter the running container + docker-compose -p jenkins_docker exec backend /bin/bash + +clean: down ## Remove stoped containers + docker-compose -p jenkins_docker rm diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..944f856 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3' +services: + backend: + build: ./ + network_mode: "bridge" + container_name: jenkins_docker + image: thornycrackers/jenkins_docker + ports: + - "8000" + - "50000" + volumes: + - ./jenkins_home:/var/jenkins_home + - /var/run/docker.sock:/var/run/docker.sock + command: /bin/bash + tty: true + stdin_open: true diff --git a/jenkins_home/.gitkeep b/jenkins_home/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/jenkins_home/.gitkeep |