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

Cordova Build with SIGNING

Cordova build時,預設會使用debug模式,不過也會加入簽署資訊,使用預設的keystore,當完成程式後要發行或push到Google play時就需要自己製做signing的keystore了。
不加簽直接Release指令:

cordova build --release android

加簽方法:

  1. keytool generator keystore,使用keytool 建立keystore檔案

語法:

keytool -genkey -v -keystore <keystoreName>.keystore -alias <Keystore AliasName> -keyalg <Key algorithm> -keysize <Key size> -validity <Key Validity in Days>

Read More