Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-Integration fuer lokale Entwicklung und Github Packages/Dockerhub #30

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/build_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Docker Image

on:
push:
branches:
- master
- feature/docker

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image for the Client
run: docker build . --file Dockerfile --target client --tag ghcr.io/janspeller/bw3-core/client:latest
- name: Build the Docker image for the Server
run: docker build . --file Dockerfile --target server --tag ghcr.io/janspeller/bw3-core/server:latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Push the Client Docker image to Github package repository
run: docker push ghcr.io/janspeller/bw3-core/client:latest
- name: Push the Server Docker image to Github package repository
run: docker push ghcr.io/janspeller/bw3-core/server:latest
40 changes: 27 additions & 13 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
FROM alpine:3.13 AS build-base
RUN apk add git make cmake g++ libusb-dev libpulse
FROM alpine:latest AS build-base
RUN apk add --no-cache git make cmake g++ libusb-dev libpulse

FROM build-base AS rtl_fm
ARG RTL_SDR_VERSION=0.6.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wieso sind die Versionsnummern weggefallen?
Das wurde damals ja extra so gemacht, weil es Probleme mit einer neueren Version gab.
So konnte man zum Build explizit vorgeben, was genutzt werden.
Same @ rtl_fm

Durch das ARG konnte man die Nummer dann nämlich auch zum Buildzeitpunkt übergeben.

RUN git clone --depth 1 --branch ${RTL_SDR_VERSION} https://github.com/osmocom/rtl-sdr.git /opt/rtl_sdr
RUN git clone --depth 1 https://gitea.osmocom.org/sdr/rtl-sdr.git /opt/rtl_sdr
WORKDIR /opt/rtl_sdr/build
RUN cmake .. && make
RUN make install

FROM build-base AS multimon
ARG MULTIMON_VERSION=1.1.9
RUN git clone --depth 1 --branch ${MULTIMON_VERSION} https://github.com/EliasOenal/multimon-ng.git /opt/multimon
RUN git clone --depth 1 https://github.com/EliasOenal/multimon-ng.git /opt/multimon
WORKDIR /opt/multimon/build
RUN cmake .. && make

FROM alpine:3.13 AS boswatch
FROM alpine:latest AS boswatch
ARG BW_VERSION=develop
RUN apk add git && \
git clone --depth 1 --branch ${BW_VERSION} https://github.com/BOSWatch/BW3-Core.git /opt/boswatch


FROM python:3.9.1-alpine AS runner
LABEL maintainer="bastian@schroll-software.de"
FROM python:alpine AS client
LABEL org.opencontainers.image.authors="info@schroll-it.de,jan@speller.biz"
LABEL org.opencontainers.image.source=https://github.com/janspeller/BW3-Core

# for RTL for MM
RUN apk add libusb-dev libpulse && \
pip3 install pyyaml
RUN apk add libusb-dev libpulse
RUN pip3 install pyyaml
Comment on lines +26 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wieso zweimal RUN direkt nacheinander?
Am besten beide Befehle in einen Verknüpfen.
Das reduziert die Container Größe.


COPY --from=boswatch /opt/boswatch/ /opt/boswatch/
COPY --from=multimon /opt/multimon/build/multimon-ng /opt/multimon-ng
COPY --from=rtl_fm /opt/rtl_sdr/build/src/ /opt/rtl_sdr
COPY --from=multimon /opt/multimon/build/multimon-ng /opt/multimon/multimon-ng
COPY --from=rtl_fm /usr/local/bin/rtl_fm /opt/rtl_sdr/rtl_fm
COPY --from=rtl_fm /usr/local/lib/librtlsdr.so.0 /usr/local/lib/librtlsdr.so.0

WORKDIR /opt/boswatch
CMD python3 /opt/boswatch/bw_client.py -c client.yaml

FROM python:alpine AS server
LABEL org.opencontainers.image.authors="info@schroll-it.de,jan@speller.biz"
LABEL org.opencontainers.image.source=https://github.com/janspeller/BW3-Core

RUN pip3 install pyyaml
COPY --from=boswatch /opt/boswatch/ /opt/boswatch/
WORKDIR /opt/boswatch
CMD python3 /opt/boswatch/bw_server.py -c server.yaml
EXPOSE 8080
6 changes: 3 additions & 3 deletions config/client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ client:
sendDelay: 3 # time in seconds to delay the resend try

server: # only used if useBroadcast = no
ip: 127.0.0.1
ip: 127.0.0.1 # use service name if you are running docker
port: 8080

inputSource:
Expand All @@ -27,7 +27,7 @@ inputSource:
squelch: 1
gain: 100
#fir_size: 0
rtlPath: /usr/local/bin/rtl_fm
rtlPath: /opt/rtl_sdr/rtl_fm
lineIn:
card: 1
device: 0
Expand All @@ -38,5 +38,5 @@ decoder:
poc512: yes
poc1200: yes
poc2400: yes
Path: /opt/multimon/multimon-ng
path: /opt/multimon/multimon-ng
char: DE
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
client:
image: ghcr.io/janspeller/bw3-core/client:latest
volumes:
- ./config:/opt/boswatch/config
- ./log:/opt/boswatch/log
devices:
- "/dev/bus/usb"
server:
image: ghcr.io/janspeller/bw3-core/server:latest
volumes:
- ./config:/opt/boswatch/config
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pyyaml
# for documentation generating
mkdocs

# for develope only
# for develop only
pytest
pytest-cov
pytest-flake8
Expand Down