Skip to content

Commit

Permalink
Add Jenkins controller setup lab (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungbq authored Jul 30, 2024
1 parent d2a276c commit b7d1af1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
33 changes: 33 additions & 0 deletions labs/jenkins-setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Jenkins setup lab

## 1. Labs stack

- 1 Jenkins controller
- 1 Jenkins agent

## 2. Setup

### Prerequisites

- Docker + Docker Compose

### Build and run the containers

```bash
cd labs/jenkins-setup
docker-compose up --build -d

# To stop and remove contaienr, run:
docker compose down
```

## 3. Explore the Jenkins

- Visit http://localhost:8080/ to explore and use Jenkins
- Get the init password to login (Login admin/initialAdminPassword):

```bash
docker exec jenkins-controller cat /var/jenkins_home/secrets/initialAdminPassword

# 1d86cf0e5fe14608970274adb54ec3ac
```
21 changes: 21 additions & 0 deletions labs/jenkins-setup/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3.8'

services:
jenkins-controller:
build:
context: ../../pools/jenkins/jenkins-controller
container_name: jenkins-controller
ports:
- '8080:8080'
- '50000:50000'
volumes:
- jenkins_data:/var/jenkins_home
networks:
- jenkins-network

volumes:
jenkins_data:

networks:
jenkins-network:
driver: bridge
5 changes: 5 additions & 0 deletions pools/jenkins/jenkins-controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM jenkins/jenkins:lts

# Install plugins
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli --plugin-file /usr/share/jenkins/ref/plugins.txt
2 changes: 2 additions & 0 deletions pools/jenkins/jenkins-controller/plugins.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
git:5.2.2
blueocean:1.27.14

0 comments on commit b7d1af1

Please sign in to comment.