Reduce docker image size to between 1/5 and 2/5 of previous size. Correct readme docker notes. Remove redundant calls.

This commit is contained in:
James Paul Turner 2021-01-21 19:51:04 +00:00
parent e7dca90355
commit e031798722
2 changed files with 20 additions and 19 deletions

View File

@ -3,23 +3,18 @@ FROM python:3.7-slim-buster
COPY entrypoint /entrypoint
RUN useradd -u 54000 radio && \
apt update && \
apt install -y git && \
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 && \
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 && \
chown radio /opt/freedmr
USER radio
apt update && \
apt install -y git gcc && \
cd /opt && \
git clone https://github.com/hacknix/freedmr && \
cd freedmr && \
pip install --no-cache-dir -r requirements.txt && \
apt autoremove -y git gcc && \
rm -rf /var/lib/apt/lists/* && \
chown -R radio: /opt/freedmr
EXPOSE 54000
USER radio
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**
Build the docker image
Build the docker image.
```bash
docker build --tag freedmr .
```
Start your container
Start your container, passing your configuration file.
```bash
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**