FROM ubuntu

RUN mkdir -p /usr/src/kii/

WORKDIR /usr/src/kii/

RUN mkdir monitor/
RUN mkdir -p services/temp-process/
RUN touch services/temp-process/dep.txt
RUN touch services/temp-process/run.sh
RUN echo "./services/temp-process/temp-process &>/dev/null" >> services/temp-process/run.sh

COPY target/x86_64-unknown-linux-gnu/release/runner-rs monitor/
COPY settings.json .
COPY temp-process services/temp-process/
 
RUN chmod +x services/temp-process/temp-process
RUN chmod +x services/temp-process/run.sh
RUN chmod +x monitor/runner-rs

# some troubles with execution this row-cmd
# ?: cannot get while initializing container
RUN export ENODE_CID=$(cat /proc/self/mountinfo | grep "/docker/containers/" | head -1 | awk -F '/' "{print \$6}")

ENTRYPOINT [ "/usr/src/kii/monitor/runner-rs" ]
