Update jenkins for external docker use
This commit is contained in:
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM jenkins/jenkins:lts
|
||||
|
||||
USER root
|
||||
|
||||
# Docker dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
lsb-release
|
||||
|
||||
# Add Docker repo
|
||||
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
|
||||
|
||||
# Install docker client
|
||||
RUN apt-get update && apt-get install -y docker-ce-cli
|
||||
|
||||
USER jenkins
|
||||
@@ -1,10 +1,14 @@
|
||||
services:
|
||||
jenkins:
|
||||
image: jenkins/jenkins:lts
|
||||
build: .
|
||||
image: jenkins-docker
|
||||
container_name: jenkins
|
||||
restart: always
|
||||
volumes:
|
||||
- jenkins_home:/var/jenkins_home
|
||||
- /run/user/1001/docker.sock:/var/run/docker.sock #rootless
|
||||
environment:
|
||||
- DOCKER_HOST=unix:///var/run/docker.sock #rootless
|
||||
networks:
|
||||
- reverse-proxy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user