mirror of
https://github.com/MobSF/Mobile-Security-Framework-MobSF.git
synced 2026-10-12 02:06:59 +00:00
decrease docker rebuild time after source code change
This commit is contained in:
+32
-30
@@ -1,7 +1,7 @@
|
||||
#Base image
|
||||
# Base image
|
||||
FROM ubuntu:18.04
|
||||
|
||||
#Labels and Credits
|
||||
# Labels and Credits
|
||||
LABEL \
|
||||
name="MobSF" \
|
||||
author="Ajin Abraham <[email protected]>" \
|
||||
@@ -10,7 +10,7 @@ LABEL \
|
||||
contributor_2="Vincent Nadal <[email protected]>" \
|
||||
description="Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis."
|
||||
|
||||
#Environment vars
|
||||
# Environment vars
|
||||
ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
ANALYZER_IDENTIFIER="" \
|
||||
JDK_FILE="openjdk-12_linux-x64_bin.tar.gz" \
|
||||
@@ -19,7 +19,7 @@ ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
ENV JDK_URL="https://download.java.net/java/GA/jdk12/GPL/${JDK_FILE}" \
|
||||
WKH_URL="https://builds.wkhtmltopdf.org/0.12.1.4/${WKH_FILE}"
|
||||
|
||||
#see https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
|
||||
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
|
||||
RUN apt update -y && apt install -y \
|
||||
build-essential \
|
||||
git \
|
||||
@@ -32,7 +32,7 @@ RUN apt update -y && apt install -y \
|
||||
fontconfig-config \
|
||||
libjpeg-turbo8 \
|
||||
libxrender1 \
|
||||
libfontconfig1 \
|
||||
libfontconfig1 \
|
||||
libxext6 \
|
||||
fontconfig \
|
||||
xfonts-75dpi \
|
||||
@@ -42,47 +42,32 @@ RUN apt update -y && apt install -y \
|
||||
python3-pip \
|
||||
wget \
|
||||
android-tools-adb
|
||||
|
||||
#set locales
|
||||
|
||||
# Set locales
|
||||
RUN locale-gen en_US.UTF-8
|
||||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
|
||||
|
||||
#Install Wkhtmltopdf
|
||||
# Install Wkhtmltopdf
|
||||
RUN wget --quiet -O /tmp/${WKH_FILE} "${WKH_URL}" && \
|
||||
dpkg -i /tmp/${WKH_FILE} && \
|
||||
apt-get install -f -y --no-install-recommends && \
|
||||
ln -s /usr/local/bin/wkhtmltopdf /usr/bin && \
|
||||
rm -f /tmp/${WKH_FILE}
|
||||
|
||||
#Install OpenJDK12
|
||||
# Install OpenJDK12
|
||||
RUN wget --quiet "${JDK_URL}" && \
|
||||
tar zxf "${JDK_FILE}" && \
|
||||
rm -f "${JDK_FILE}"
|
||||
ENV JAVA_HOME="/jdk-12"
|
||||
ENV JAVA_HOME="/jdk-12"
|
||||
ENV PATH="$JAVA_HOME/bin:$PATH"
|
||||
|
||||
#Add MobSF master
|
||||
COPY . /root/Mobile-Security-Framework-MobSF
|
||||
WORKDIR /root/Mobile-Security-Framework-MobSF
|
||||
COPY ./requirements.txt .
|
||||
|
||||
#Enable Use Home Directory and set adb path
|
||||
RUN sed -i 's/USE_HOME = False/USE_HOME = True/g' MobSF/settings.py && \
|
||||
sed -i "s#ADB_BINARY = ''#ADB_BINARY = '/usr/bin/adb'#" MobSF/settings.py
|
||||
|
||||
#Postgres support is set to false by default
|
||||
ARG POSTGRES=False
|
||||
#check if Postgres support needs to be enabled
|
||||
WORKDIR /root/Mobile-Security-Framework-MobSF/scripts
|
||||
RUN chmod +x postgres_support.sh; sync; ./postgres_support.sh $POSTGRES
|
||||
WORKDIR /root/Mobile-Security-Framework-MobSF
|
||||
|
||||
#Add apktool working path
|
||||
RUN mkdir -p /root/.local/share/apktool/framework
|
||||
|
||||
#Install Dependencies
|
||||
# Install Dependencies
|
||||
RUN pip3 install --quiet --no-cache-dir -r requirements.txt
|
||||
|
||||
#Cleanup
|
||||
# Cleanup
|
||||
RUN \
|
||||
apt remove -y \
|
||||
git \
|
||||
@@ -97,7 +82,24 @@ RUN \
|
||||
apt autoremove -y && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* > /dev/null 2>&1
|
||||
|
||||
#Expose MobSF Port
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Enable Use Home Directory and set adb path
|
||||
RUN sed -i 's/USE_HOME = False/USE_HOME = True/g' MobSF/settings.py && \
|
||||
sed -i "s#ADB_BINARY = ''#ADB_BINARY = '/usr/bin/adb'#" MobSF/settings.py
|
||||
|
||||
# Postgres support is set to false by default
|
||||
ARG POSTGRES=False
|
||||
# Check if Postgres support needs to be enabled
|
||||
WORKDIR /root/Mobile-Security-Framework-MobSF/scripts
|
||||
RUN chmod +x postgres_support.sh; sync; ./postgres_support.sh $POSTGRES
|
||||
WORKDIR /root/Mobile-Security-Framework-MobSF
|
||||
|
||||
# Add apktool working path
|
||||
RUN mkdir -p /root/.local/share/apktool/framework
|
||||
|
||||
# Expose MobSF Port
|
||||
EXPOSE 8000
|
||||
# MobSF Proxy
|
||||
EXPOSE 1337
|
||||
@@ -106,5 +108,5 @@ RUN python3 manage.py makemigrations && \
|
||||
python3 manage.py makemigrations StaticAnalyzer && \
|
||||
python3 manage.py migrate
|
||||
|
||||
#Run MobSF
|
||||
# Run MobSF
|
||||
CMD ["gunicorn", "-b", "0.0.0.0:8000", "MobSF.wsgi:application", "--workers=1", "--threads=10", "--timeout=1800"]
|
||||
|
||||
Reference in New Issue
Block a user