-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Dockerfile
99 lines (86 loc) · 2.82 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Base image
FROM python:3.12-slim-bookworm
LABEL \
name="MobSF" \
author="Ajin Abraham <[email protected]>" \
maintainer="Ajin Abraham <[email protected]>" \
contributor_1="OscarAkaElvis <[email protected]>" \
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."
ENV DEBIAN_FRONTEND=noninteractive \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONFAULTHANDLER=1 \
MOBSF_USER=mobsf \
USER_ID=9901 \
MOBSF_PLATFORM=docker \
MOBSF_ADB_BINARY=/usr/bin/adb \
JAVA_HOME=/jdk-22.0.2 \
PATH=/jdk-22.0.2/bin:/root/.local/bin:$PATH \
DJANGO_SUPERUSER_USERNAME=mobsf \
DJANGO_SUPERUSER_PASSWORD=mobsf
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
RUN apt update -y && \
apt install -y --no-install-recommends \
android-sdk-build-tools \
android-tools-adb \
build-essential \
curl \
fontconfig \
fontconfig-config \
git \
libfontconfig1 \
libjpeg62-turbo \
libxext6 \
libxrender1 \
locales \
python3-dev \
sqlite3 \
unzip \
wget \
xfonts-75dpi \
xfonts-base && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8 && \
apt upgrade -y && \
curl -sSL https://install.python-poetry.org | python3 - && \
apt autoremove -y && apt clean -y && rm -rf /var/lib/apt/lists/* /tmp/*
ARG TARGETPLATFORM
# Install wkhtmltopdf, OpenJDK and jadx
COPY scripts/dependencies.sh mobsf/MobSF/tools_download.py ./
RUN ./dependencies.sh
# Install Python dependencies
COPY pyproject.toml .
RUN poetry config virtualenvs.create false && \
poetry lock && \
poetry install --only main --no-root --no-interaction --no-ansi && \
poetry cache clear . --all && \
rm -rf /root/.cache/
# Cleanup
RUN \
apt remove -y \
git \
python3-dev \
wget && \
apt clean && \
apt autoclean && \
apt autoremove -y && \
rm -rf /var/lib/apt/lists/* /tmp/* > /dev/null 2>&1
# Copy source code
WORKDIR /home/mobsf/Mobile-Security-Framework-MobSF
COPY . .
HEALTHCHECK CMD curl --fail http://host.docker.internal:8000/ || exit 1
# Expose MobSF Port and Proxy Port
EXPOSE 8000 1337
# Create mobsf user
RUN groupadd --gid $USER_ID $MOBSF_USER && \
useradd $MOBSF_USER --uid $USER_ID --gid $MOBSF_USER --shell /bin/false && \
chown -R $MOBSF_USER:$MOBSF_USER /home/mobsf
# Switch to mobsf user
USER $MOBSF_USER
# Run MobSF
CMD ["/home/mobsf/Mobile-Security-Framework-MobSF/scripts/entrypoint.sh"]