由于项目需要,需要在docker 环境中安装apktool,用于解析安卓包,如下是安装步骤。
安装Java环境
下载Java安装包
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
wget https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-linux-x64.tar.gz
该链接已经失效,请自行到官网复制链接下载
安装Java sdk
mkdir /usr/local/java
tar -zxvf jdk-8u221-linux-x64.tar.gz -C /usr/local/java/
设置环境变量
vi /etc/profile
在末尾添加
export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
使环境变量生效
source /etc/profile
添加软链接
ln -s /usr/local/java/jdk1.8.0_221/bin/java /usr/bin/java
检查
java -version
安装apktool
https://ibotpeaches.github.io/Apktool/install/
通过官方提供的wrapper script 安装
wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool -O /usr/local/bin/apktool
chmod a+x /usr/local/bin/apktool
wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.4.0.jar
mv apktool_2.4.0.jar /usr/local/bin/apktool.jar
检查
安装完毕
生成新的镜像
docker commit -a "wutongci xxxxx@hotmail.com" -m "apktool" centos apktool
docker tag apktool bullteam/apktool
docker push bullteam/apktool:latest
推送到dockerhub仓库