Merge pull request #4 from jamesturner246/docker-cleanup

Reduce docker image size to between 1/5 and 2/5 of previous size. Cor…
This commit is contained in:
hacknix 2021-01-21 21:29:21 +00:00 committed by GitHub
commit be3f6ca4fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 19 deletions

View File

@ -4,22 +4,17 @@ COPY entrypoint /entrypoint
RUN useradd -u 54000 radio && \ RUN useradd -u 54000 radio && \
apt update && \ apt update && \
apt install -y git && \ apt install -y git gcc && \
cd /usr/src/ && \
git clone https://github.com/hacknix/dmr_utils && \
cd /usr/src/dmr_utils && \
./install.sh && \
rm -rf /var/lib/apt/lists/* && \
cd /opt && \ cd /opt && \
rm -rf /usr/src/dmr_utils && \
git clone https://github.com/hacknix/freedmr && \ git clone https://github.com/hacknix/freedmr && \
cd /opt/freedmr/ && \ cd freedmr && \
sed -i s/.*python.*//g requirements.txt && \
pip install --no-cache-dir -r requirements.txt && \ pip install --no-cache-dir -r requirements.txt && \
chown radio /opt/freedmr apt autoremove -y git gcc && \
rm -rf /var/lib/apt/lists/* && \
USER radio chown -R radio: /opt/freedmr
EXPOSE 54000 EXPOSE 54000
USER radio
ENTRYPOINT [ "/entrypoint" ] ENTRYPOINT [ "/entrypoint" ]

View File

@ -39,17 +39,23 @@ This document assumes the reader is familiar with Linux/UNIX, the Python program
**Using the docker version** **Using the docker version**
Build the docker image Build the docker image.
```bash ```bash
docker build --tag freedmr . docker build --tag freedmr .
``` ```
Start your container Start your container, passing your configuration file.
```bash ```bash
cfg_file="/absolute/path/to/cfg/file" cfg_file="/absolute/path/to/cfg/file"
run -v $cfg_file:/opt/freedmr/hblink.cfg -p 54000:54000 freedmr docker run -v $cfg_file:/opt/freedmr/hblink.cfg -p 54000:54000 freedmr
```
Note that `$cfg_file` is used by the container's 'radio' user internally, so you may need to modify file permissions.
```bash
chmod 666 $cfg_file
``` ```
**MORE DOCUMENTATION TO COME** **MORE DOCUMENTATION TO COME**