-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ARG IPED_RELEASE_VERSION=4.1.3 SNAPSHOT=false SNAPSHOT_WORKFLOW_ID=5073165507 PKGTMPDIR=/tmp/pkgs | ||
|
||
ENV TZ=Brazil/East DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 \ | ||
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ | ||
|
||
RUN mkdir -p ${PKGTMPDIR} && cd ${PKGTMPDIR} \ | ||
&& apt-get update && apt-get install -y curl \ | ||
&& apt-get dist-upgrade -y \ | ||
&& apt-get install -y \ | ||
openjdk-11-jre-headless \ | ||
&& 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}_and_plugins.zip --output ${PKGTMPDIR}/iped.zip && \ | ||
unzip ${PKGTMPDIR}/iped.zip iped*/lib/iped-engine-*.jar ;\ | ||
fi \ | ||
&& echo "Creating IPED simbolic links..." \ | ||
&& ls | grep "iped-" | xargs -i sh -c 'ln -s "{}" iped' \ | ||
&& cd /opt/IPED/iped/lib \ | ||
&& ls | grep "iped-engine-" | xargs -i sh -c 'ln -s "{}" iped-engine.jar' \ | ||
&& echo "#####################################" \ | ||
&& echo "Cleaning UP the container " \ | ||
&& echo "#####################################" \ | ||
&& rm -rf ${PKGTMPDIR} | ||
|
||
WORKDIR /opt/IPED/iped | ||
CMD ["/bin/bash"] |