# Based on https://github.com/log2timeline/plaso/blob/master/config/docker/Dockerfile
# See also https://plaso.readthedocs.io/en/latest/sources/developer/Dependencies.html#ubuntu

ARG UBUNTU_VERSION
FROM ubuntu:${UBUNTU_VERSION:-bionic}

MAINTAINER Marek Rychly <marek.rychly@gmail.com>

ARG GIT_REV="master"
ARG PPA_TRACK="stable"
ARG DEP_SCRIPT="gift_ppa_install_py3"

RUN true \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y update \
&& apt-get -y install software-properties-common apt-transport-https locales wget \
# Set terminal to UTF-8 by default
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
#
# GIT release
#
&& wget -O - "https://github.com/log2timeline/plaso/archive/${GIT_REV}.tar.gz" | tar xzC /opt \
&& ln -vs /opt/plaso-* /opt/plaso \
&& sed -i -e "s|ppa:gift/dev|ppa:gift/${PPA_TRACK}|g" -e 's|sudo ||g' "/opt/plaso/config/linux/${DEP_SCRIPT}.sh" \
&& "/opt/plaso/config/linux/${DEP_SCRIPT}.sh" include-development include-test \
#
# STABLE release from packages (without git clone)
# Run log2timeline on artifacts stored in /data/artifacts with:
# docker run -ti -v /data/:/data/ <container_id> --entrypoint /usr/local/bin/plaso-switch.sh log2timeline /data/results/result.plaso /data/artifacts
#
#&& apt-get -y install python-plaso plaso-tools locales \
#&& wget -O /usr/local/bin/plaso-switch.sh https://raw.githubusercontent.com/log2timeline/plaso/master/config/docker/plaso-switch.sh \
#&& chmod -v a+x /usr/local/bin/plaso-switch.sh \
#
&& apt-get -y autoremove --purge wget \
&& apt-get clean \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*

ENV \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

VOLUME ["/data"]
