Commit 757fcf81 authored by cgal136's avatar cgal136

TNG-01 [claudio] first commit

parents
.DS_Store
\ No newline at end of file
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:somepass' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
EXPOSE 8080
# Install OpenJDK-11
RUN apt-get install -y software-properties-common && \
add-apt-repository ppa:openjdk-r/ppa && \
apt-get update && \
apt-get install -y openjdk-11-jdk && \
apt-get install -y ant && \
apt-get clean;
# Fix certificate issues
RUN apt-get update && \
apt-get install ca-certificates-java && \
apt-get clean && \
update-ca-certificates -f;
# Setup JAVA_HOME -- useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME
#install ngnx
RUN apt-get -yq install nginx
ADD spring.conf /etc/nginx/conf.d/
RUN /etc/init.d/nginx start
#install git
RUN apt-get -yq install git
#fix maven certs issues
RUN /usr/bin/printf '\xfe\xed\xfe\xed\x00\x00\x00\x02\x00\x00\x00\x00\xe2\x68\x6e\x45\xfb\x43\xdf\xa4\xd9\x92\xdd\x41\xce\xb6\xb2\x1c\x63\x30\xd7\x92' > /etc/ssl/certs/java/cacerts
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure
CMD ["/usr/sbin/sshd", "-D"]
## 1. Install Docker Host
https://docs.docker.com/docker-for-mac/install/
## 2. Start and Configure the Jenkins Server
```
# creates the internal docker network
docker network create jenkins
# pull and start the jenkins docker image
docker pull jenkins/jenkins:lts
docker run -p 8080:8080 -p 50000:50000 --network jenkins --hostname jenkins jenkins/jenkins:lts
```
## 3. Create the devenv Docker Container
```
docker build -t 'devenv' .
docker run -d -p 8090:8080 -p 3001:22 --name devenv --network jenkins --hostname devenv devenv:latest
```
## 4. Configure devenv container as docker-slave
#### 4.1 go to manage jenkins
![Manage Jenkins](/images/1.png)
#### 4.2 go to manage nodes
![Manage Nodes](/images/2.png)
#### 4.3 go to New Node
#### 4.4 configure the node
![Slave Config](/images/3.png)
#### 4.5 add credentials for jenkins to use the slave node
![Creds](/images/4.png)
## 5. Create a multibranch pipeline for the project
#### 5.1 Configure the job
![pipeline config](/images/5.png)
#### 5.2 point to git repo https://github.com/D3adlock/cicd-pipeline-handson-code
![pipeline config](/images/6.png)
server {
listen 8080;
location / {
proxy_pass http://127.0.0.1:8081;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment