FROM registry.yandex.net/rtc-base/focal:stable
env DEBIAN_FRONTEND=noninteractive`

RUN set -xe && \
    ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime

####################
# COMMON PART
####################
# for systems with apt
RUN apt update && \
    apt install -y python3-jinja2 python3-dotenv
# for systems without apt but with pip
# RUN python -m pip install --upgrade pip && \
#    pip install python-dotenv && pip install Jinja2

# Python3 as default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

# Copy parser and environment to root
COPY fill_templates.py /
# COPY .env /

########################
# CUSTOM PART
########################

# Put tpl-files where they will be parsed
COPY *.tpl /

COPY sender.bin /
# COPY osquery_sender/server* /crt/
COPY crt/ /crt/
COPY entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]                   # MUST be JSON-array syntax

# Place here original ENTRYPOINT and update it when in mother Dockerfile it will be updated\changed
CMD ["/sender.bin", "-config", "/config.yaml"]
