From 9ba975bfff60f4d17546688d2765571a8679ebde Mon Sep 17 00:00:00 2001 From: Millaguie Date: Sun, 22 Sep 2019 18:17:10 +0200 Subject: [PATCH] Add support for configuration from directory instead a git repo --- Dockerfile | 4 +--- entrypoint | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) mode change 100644 => 100755 entrypoint diff --git a/Dockerfile b/Dockerfile index 14b55f0..842c902 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apt update && \ cd /opt && \ rm -rf /usr/src/dmr_utils3 && \ git clone https://github.com/n0mjs710/hblink3 - +ENV AAA BBBB RUN cd /opt/hblink3/ && \ sed -i s/.*python.*//g requirements.txt && \ pip install --no-cache-dir -r requirements.txt @@ -24,8 +24,6 @@ RUN adduser -u 54000 radio && \ chown radio:radio /entrypoint && \ chown radio /opt/hblink3 -RUN chmod 755 /entrypoint - USER radio EXPOSE 54000 diff --git a/entrypoint b/entrypoint old mode 100644 new mode 100755 index 84a03e2..422f0f3 --- a/entrypoint +++ b/entrypoint @@ -1,10 +1,19 @@ #!/bin/sh -mkdir -p /var/tmp/config -cd /var/tmp/config -git clone https://${GIT_USER}:${GIT_PASSWORD}@${GIT_REPO} +if [ -z "$GIT_REPO" ]; then + mkdir -p /var/tmp/config + cd /var/tmp/config + git clone https://${GIT_USER}:${GIT_PASSWORD}@${GIT_REPO} -DIR=$(echo ${GIT_REPO}| sed s/.git$//g | sed s#^.*/##g) + DIR=$(echo ${GIT_REPO}| sed s/.git$//g | sed s#^.*/##g) -cp -a /var/tmp/config/${DIR}/*cfg /opt/hblink3/ -python /opt/hblink3/hblink.py + cp -a /var/tmp/config/${DIR}/*cfg /opt/hblink3/ + cp -a /var/tmp/config/${DIR}/*csv /opt/hblink3/ + cp -a /var/tmp/config/${DIR}/*json /opt/hblink3/ +else + cp -a /opt/config/*cfg /opt/hblink3/ + cp -a /opt/config/*csv /opt/hblink3/ + cp -a /opt/config/*json /opt/hblink3/ +fi +cd /opt/hblink3 +python /opt/hblink3/hblink.py -c hblink.cfg