From ccb49b4b46efe718b46e3fab5ea58913e8e5334c Mon Sep 17 00:00:00 2001 From: James Paul Turner Date: Sun, 17 Jan 2021 21:01:33 +0000 Subject: [PATCH] Fix and tidy the Docker files. --- Dockerfile | 31 +++++++++++++------------------ README.md | 24 +++++++----------------- entrypoint | 19 ++----------------- 3 files changed, 22 insertions(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5562736..62e6829 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,25 @@ -FROM python:3.7-slim-stretch +FROM python:3.7-slim-buster -RUN apt update && \ +COPY entrypoint /entrypoint + +RUN useradd -u 54000 radio && \ + apt update && \ apt install -y git && \ cd /usr/src/ && \ - git clone https://github.com/n0mjs710/dmr_utils3 && \ - cd /usr/src/dmr_utils3 && \ + git clone https://github.com/hacknix/dmr_utils && \ + cd /usr/src/dmr_utils && \ ./install.sh && \ rm -rf /var/lib/apt/lists/* && \ cd /opt && \ - rm -rf /usr/src/dmr_utils3 && \ - git clone https://github.com/hacknix/hblink3 -ENV AAA BBBB -RUN cd /opt/hblink3/ && \ + rm -rf /usr/src/dmr_utils && \ + git clone https://github.com/hacknix/freedmr && \ + cd /opt/freedmr/ && \ sed -i s/.*python.*//g requirements.txt && \ - pip install --no-cache-dir -r requirements.txt - - -ADD entrypoint /entrypoint - -RUN adduser -u 54000 radio && \ - adduser radio radio && \ - chmod 755 /entrypoint && \ - chown radio:radio /entrypoint && \ - chown radio /opt/hblink3 + pip install --no-cache-dir -r requirements.txt && \ + chown radio /opt/freedmr USER radio + EXPOSE 54000 ENTRYPOINT [ "/entrypoint" ] diff --git a/README.md b/README.md index e3bb1f7..e9f74f6 100755 --- a/README.md +++ b/README.md @@ -36,31 +36,21 @@ None. The owners of this work make absolutely no warranty, express or implied. U **PRE-REQUISITE KNOWLEDGE:** This document assumes the reader is familiar with Linux/UNIX, the Python programming language and DMR. -**Using docker version** -To work with provided docker setup you will need: -* A private repository with your configuration files (all .cfg files in repo will be copyed to the application root directory on start up) -* A service user able to read your private repository (or be brave and publish your configuration, or be really brave and give your username and password to the docker) -* A server with docker installed -* Follow this simple steps: +**Using the docker version** -Build your own image from source +Build the docker image ```bash - -docker build . -t millaguie/hblink:3.0.0 - +docker build --tag freedmr . ``` -Or user a prebuilt one in docker hub: millaguie/hblink:3.0.0 - -Wake up your container +Start your container ```bash -touch /var/log/hblink.log -chown 65000 /var/log/hblink.log - run -v /var/log/hblink.log:/var/log/hblink.log -e GIT_USER=$USER -e GIT_PASSWORD=$PASSWORD -e GIT_REPO=$URL_TO_REPO_WITHOUT_HTTPS:// -p 54000:54000 millaguie/hblink:3.0.0 - ``` +cfg_file="/absolute/path/to/cfg/file" +run -v $cfg_file:/opt/freedmr/hblink.cfg -p 54000:54000 freedmr +``` **MORE DOCUMENTATION TO COME** diff --git a/entrypoint b/entrypoint index 422f0f3..92c1f92 100755 --- a/entrypoint +++ b/entrypoint @@ -1,19 +1,4 @@ #!/bin/sh -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) - - 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 +cd /opt/freedmr +python /opt/freedmr/hblink.py -c hblink.cfg