Merge pull request #8 from millaguie/docker

Add support for configuration from directory instead a git repo
This commit is contained in:
Cort Buffington 2019-09-22 11:29:05 -05:00 committed by GitHub
commit 84800d690a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View File

@ -10,7 +10,7 @@ RUN apt update && \
cd /opt && \ cd /opt && \
rm -rf /usr/src/dmr_utils3 && \ rm -rf /usr/src/dmr_utils3 && \
git clone https://github.com/n0mjs710/hblink3 git clone https://github.com/n0mjs710/hblink3
ENV AAA BBBB
RUN cd /opt/hblink3/ && \ RUN cd /opt/hblink3/ && \
sed -i s/.*python.*//g requirements.txt && \ sed -i s/.*python.*//g requirements.txt && \
pip install --no-cache-dir -r 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:radio /entrypoint && \
chown radio /opt/hblink3 chown radio /opt/hblink3
RUN chmod 755 /entrypoint
USER radio USER radio
EXPOSE 54000 EXPOSE 54000

11
entrypoint Normal file → Executable file
View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
if [ -z "$GIT_REPO" ]; then
mkdir -p /var/tmp/config mkdir -p /var/tmp/config
cd /var/tmp/config cd /var/tmp/config
git clone https://${GIT_USER}:${GIT_PASSWORD}@${GIT_REPO} git clone https://${GIT_USER}:${GIT_PASSWORD}@${GIT_REPO}
@ -7,4 +8,12 @@ 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/ cp -a /var/tmp/config/${DIR}/*cfg /opt/hblink3/
python /opt/hblink3/hblink.py 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