From f5c89354ce5db93c8a74f0bc6b25733d8326f2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Izzo?= Date: Thu, 4 Jul 2024 09:27:17 +0200 Subject: [PATCH] Add Docker based deployment files With this Dockerfile and docker-compose.yml, users can deploy this service on any docker-enabled system, including linux servers, laptops, NAS etc. --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 10 ++++++++++ 2 files changed, 50 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ab27c49 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM alpine:latest +MAINTAINER Niccolò Izzo + +ENV HAMLIB_VERSION '4.5.5' + +# Install dependencies +RUN apk add --no-cache git \ + python3 \ + py3-pyalsaaudio \ + py3-numpy \ + py3-tornado \ + py3-pyserial \ + py3-pyaudio \ + py3-hamlib \ + py3-pip \ + librtlsdr \ + autoconf \ + automake \ + libtool \ + swig \ + alpine-sdk +RUN apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing py3-pam +RUN pip3 install pyrtlsdr --break-system-packages + +# Build hamlib from source +RUN mkdir /hamlib +WORKDIR /hamlib +RUN git clone https://github.com/Hamlib/Hamlib.git src +RUN cd src && git checkout Hamlib-$HAMLIB_VERSION && ./bootstrap && mkdir ../build && cd ../build && \ + ../src/configure --prefix=$HOME/hamlib-prefix --disable-shared --enable-static --without-cxx-binding --disable-winradio CFLAGS="-g -O2 -fdata-sections -ffunction-sections" LDFLAGS="-Wl,--gc-sections" && \ + make -j4 && make install-strip && cd ../../ + +# Copy UHRR source files from host dir +RUN mkdir /uhrh +WORKDIR /uhrh +COPY . /uhrh +RUN ls /uhrh + +# ENV PYTHONPATH=/usr/local/lib/python3.7/site-packages:$PYTHONPATH +CMD ["./UHRR"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8a2c702 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + uhrh: + build: . + container_name: uhrh + restart: always + devices: + - /dev/snd:/dev/snd + - /dev/ttyUSB0:/dev/ttyUSB0 + ports: + - 8888:8888