Jenkins Version : Jenkins 2.332.2
(Docker Img : jenkins/jenkins:lts - https://hub.docker.com/r/jenkins/jenkins)
Installed App : Docker version 20.10.14, build a224086
-Jenkins Jobs-
Build Trigger : GitHub hook trigger for GITScm polling
Build Process: Maven targets -> Shell script
Github push (Web Hook) -> Clone source from Github repository (To Jenkins)
-> Package as War (On Jenkins's Maven) -> Build Docker's Tomcat Img (From new source)
-> Run Tomcat (With new WAR)
docker run -d --name myjenkins \
-v /var/run/docker.sock:/var/run/docker.sock \
-v jenkins:/var/jenkins_home \
-p 8080:8080 \
-u root \
-d jenkins/jenkins:lts
FROM tomcat:9.0.58
LABEL maintainer="inhoe.kim95@gmail.com"
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN rm -Rf /usr/local/tomcat/webapps/ROOT
RUN rm /usr/local/tomcat/conf/server.xml
COPY server.xml /usr/local/tomcat/conf/
COPY FinalPrj/target/final-1.0.0-BUILD-SNAPSHOT.war /usr/local/tomcat/webapps/ott.war
EXPOSE 80
CMD ["catalina.sh", "run"]
#!/bin/sh
cd /var/jenkins_home/workspace/OTT #Docker 파일이 존재하는 경로
docker rm -f mytomcat || true
docker build -t mytomcatimg .
docker run -d -p 80:80 --name mytomcat mytomcatimg