-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.transcriptor
88 lines (81 loc) · 5.35 KB
/
Dockerfile.transcriptor
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
FROM nvidia/cuda:12.1.1-runtime-ubuntu20.04
ARG SNAPSHOT=true IPED_RELEASE_VERSION=4.2 SNAPSHOT_WORKFLOW_ID=8243028270 PKGTMPDIR=/tmp/pkgs
ENV TZ=Brazil/East DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 \
SAL_USE_VCLPLUGIN='gtk' JAVA_HOME=/usr/lib/jvm/bellsoft-java11-runtime-amd64/ \
LD_LIBRARY_PATH=/usr/local/lib/python3.9/dist-packages/jep/:/usr/local/lib/python3.9/dist-packages/nvidia/cudnn/lib/
RUN mkdir -p ${PKGTMPDIR} && cd ${PKGTMPDIR} \
&& apt-get update && apt-get install -y curl \
&& apt-get dist-upgrade -y \
&& curl -s -L https://download.bell-sw.com/pki/GPG-KEY-bellsoft | tee /etc/apt/trusted.gpg.d/bellsoft.asc \
&& echo "deb [arch=amd64] https://apt.bell-sw.com/ stable main" | tee /etc/apt/sources.list.d/bellsoft.list \
&& apt-get update \
&& apt-get install -y \
bellsoft-java11-runtime \
libsndfile1 mplayer \
iproute2 iputils-ping \
python3.9 python3.9-distutils python3-pip python3.9-dev python3-setuptools \
unzip sudo jq patch \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 \
&& python -m pip install pip --upgrade \
&& python -m pip install torch torchvision torchaudio \
&& python -m pip install huggingsound \
&& python -m pip install faster-whisper \
&& echo "#####################################" \
&& echo "Cleaning UP the container " \
&& echo "#####################################" \
&& apt-get remove -y python3-pip \
&& apt-get autoremove -y \
&& rm -rf /root/.cache/pip && rm -rf ${PKGTMPDIR}/* && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN --mount=type=secret,id=ACTION_GH_TOKEN export ACTION_GH_TOKEN=$(cat /run/secrets/ACTION_GH_TOKEN) \
&& mkdir -p /opt/IPED/ && cd /opt/IPED/ \
&& if [ "${SNAPSHOT}" = "true" ]; \
then \
echo "#####################################" && \
echo "Installing IPED from SNAPSHOT " && \
echo "#####################################" && \
echo -n "Getting snapshot with run ID ${SNAPSHOT_WORKFLOW_ID}..." && \
snapshotURL=$(curl -s -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${ACTION_GH_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/sepinf-inc/IPED/actions/artifacts | \
jq --arg workflow_id $SNAPSHOT_WORKFLOW_ID -c '.artifacts[] | select(.workflow_run.id|tostring == $workflow_id) | .archive_download_url' | \
tr -d '\"') && \
echo "Downloading ${snapshotURL}..." && \
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${ACTION_GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" --output ${PKGTMPDIR}/iped.zip ${snapshotURL} && \
unzip -p ${PKGTMPDIR}/iped.zip | tar -xvz --strip-components=1; \
else \
echo "#####################################" && \
echo "Installing IPED from RELEASE " && \
echo "#####################################" && \
curl -L https://github.com/sepinf-inc/IPED/releases/download/$IPED_RELEASE_VERSION/IPED-${IPED_RELEASE_VERSION}_plus_java_plugins.zip --output ${PKGTMPDIR}/iped.zip && \
unzip ${PKGTMPDIR}/iped.zip ;\
fi \
&& echo "Creating IPED simbolic link..." \
&& ls | grep "iped-" | xargs -i sh -c 'ln -s "{}" iped' \
&& echo "#####################################" \
&& echo "Configuring Local config with our default values" \
&& echo "#####################################" \
&& echo "If you need to change the IPED LocalConfig, use the environment variables available on /entrypoint.sh" \
&& echo "#####################################" \
&& sed -i -e "s/locale =.*/locale = pt-BR/" /opt/IPED/iped/LocalConfig.txt \
&& sed -i -e "s/indexTemp =.*/indexTemp = \/mnt\/ipedtmp/" /opt/IPED/iped/LocalConfig.txt \
&& sed -i -e "s/indexTempOnSSD =.*/indexTempOnSSD = true/" /opt/IPED/iped/LocalConfig.txt \
&& sed -i -e "s/outputOnSSD =.*/outputOnSSD = false/" /opt/IPED/iped/LocalConfig.txt \
&& sed -i -e "s/numThreads =.*/numThreads = 8/" /opt/IPED/iped/LocalConfig.txt \
&& sed -i -e "s/#hashesDB =.*/hashesDB = \/mnt\/hashesdb\/iped-hashes.db/" /opt/IPED/iped/LocalConfig.txt \
&& sed -i -e "s/#tskJarPath =.*/tskJarPath = \/opt\/IPED\/iped\/lib\/sleuthkit-4.12.0.p1.jar/" /opt/IPED/iped/LocalConfig.txt \
&& sed -i -e "s/mplayerPath =.*/mplayerPath = \/usr\/bin\/mplayer/" /opt/IPED/iped/LocalConfig.txt \
&& echo "#####################################" \
&& echo "Uncommenting a default huggingfaceModel to enable entrypoint value filling" \
&& echo "#####################################" \
&& sed -i -e "s/# huggingFaceModel = jonatasgrosman\/wav2vec2-xls-r-1b-portuguese/huggingFaceModel = large-v3/" /opt/IPED/iped/conf/AudioTranscriptConfig.txt \
&& echo "#####################################" \
&& echo "Cleaning UP the container " \
&& echo "#####################################" \
&& rm -rf ${PKGTMPDIR}
COPY resources/Wav2Vec2Process.py-alpha /opt/IPED/iped/scripts/tasks/Wav2Vec2Process.py
WORKDIR /opt/IPED/iped
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/bin/bash"]