Mariadb Tomcat Docker environment

This is a docker-compose yml,Integrated Mariadb、phpMyAdmin、tomcat Docker

How to start

  • install docker-ce and docker-compose
  • change to project directory to build and run docker
    sudo docker-compose up -d --build
  • use phpMyAdmin restore database (options)
  • build project war file and put to tomcat-webapps directory
  • browse http://yourip:8080/warFileName

docker information

  • mariadb:latest
  • phpmyadmin/phpmyadmin:latest
  • tomcat:8.5.49-jkd8-openjdk

default information

  • tomcat manager account and password admin / mypassword112233
  • mariadb root default password myadmin123
  • phpMyAdmin default port 8088
  • tomcat default port 8080 ;AJP port 8009
  • tomcat workspace is tomcat-webapps
Read More

Jenkins use docker agent with maven Compile and build Environment

github : https://github.com/catyku/JenkinsAgentMaven

docker hub :

docker pull catyku/jenkins-slave-maven3.5

Dockerfile include

  • openjdk 1.8
  • maven 3.5
  • jenkins/jnlp-slave

Dockfile

FROM jenkins/jnlp-slave:latest
USER root
ARG USER_HOME_DIR="/jenkins"

RUN apt-get update  -y
RUN apt-get install -y --no-install-recommends tzdata 
ENV TZ Asia/Taipei
#RUN apt-get upgrade  -y
#RUN apt-get install -y software-properties-common
#RUN add-apt-repository ppa:openjdk-r/ppa -y

RUN apt-get install -y maven

USER jenkins 

ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

COPY settings-docker.xml /usr/share/maven/ref/

USER jenkins 

ENTRYPOINT ["jenkins-slave"]
Read More

GitHub Maven專案自動編譯成war檔

https://github.com/catyku/AutoMavenBuild

Github的maven專案(私有)可以直接下載然後編譯成war deploy檔

需要安裝docker-ce

  • 取得及設定github ssh key可以參考以下這篇

https://help.github.com/en/enterprise/2.17/user/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

  • 修改及設定使用者名稱及專案名稱 -> run.sh (記得mvn -P 的build config也要改成相對應的)
  • 產生docker image tag名稱為maven:project ,可自行修改
  sudo docker build -t maven:project .
  • github下載及編譯打包專案
Read More

docker tomcat with manager html

範例來源

修改 FROM tomcat:8.5.49-jdk8-openjdk
加入 tomcat-users.xml 跟 manager的context.xml來取得manager/html存取權限

tomcat-users.xml為登入資訊
context.xml則管理存取ip等資訊

環境

openjdk 1.8
tomcat 8.5

編譯及執行

sudo docker build ./ -t yourname

and run

sudo docker run -d  -p 8080:8080 --name tomcat  catyku/tomcat:8.5-jre8

Read More