mirror of https://github.com/DJ2LS/FreeDATA.git
commit
ef0981055a
|
@ -0,0 +1,43 @@
|
|||
name: Build and push docker image when tagged
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the GitHub Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker images
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/dj2ls/freedata:latest
|
||||
ghcr.io/dj2ls/freedata:${{ github.ref_name }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=FreeDATA
|
||||
org.opencontainers.image.description=Docker image for FreeDATA
|
||||
org.opencontainers.image.url=https://github.com/dj2ls/freedata/pkgs/container/freedata/
|
|
@ -0,0 +1,93 @@
|
|||
################################################################################
|
||||
# Build frontend
|
||||
################################################################################
|
||||
FROM node:20-alpine AS frontend
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY freedata_gui ./
|
||||
|
||||
RUN npm install && npm run build
|
||||
|
||||
################################################################################
|
||||
# Build server
|
||||
################################################################################
|
||||
FROM python:3.11-slim-bookworm AS server
|
||||
|
||||
ARG HAMLIB_VERSION=4.5.5
|
||||
ENV HAMLIB_VERSION=${HAMLIB_VERSION}
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install --upgrade -y fonts-noto-color-emoji git build-essential cmake portaudio19-dev python3-pyaudio python3-colorama wget && \
|
||||
mkdir -p /app/FreeDATA
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
ADD https://github.com/Hamlib/Hamlib/releases/download/${HAMLIB_VERSION}/hamlib-${HAMLIB_VERSION}.tar.gz ./hamlib.tar.gz
|
||||
|
||||
RUN tar -xplf hamlib.tar.gz
|
||||
|
||||
WORKDIR /src/hamlib-${HAMLIB_VERSION}
|
||||
|
||||
RUN ./configure --prefix=/app/FreeDATA-hamlib && \
|
||||
make && \
|
||||
make install
|
||||
|
||||
WORKDIR /app/FreeDATA
|
||||
|
||||
ADD https://github.com/DJ2LS/FreeDATA.git#v0.16.10-alpha ./
|
||||
|
||||
RUN python3 -m venv /app/FreeDATA/venv
|
||||
ENV PATH="/app/FreeDATA/venv/bin:$PATH"
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade pip wheel && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
WORKDIR /app/FreeDATA/freedata_server/lib
|
||||
|
||||
ADD https://github.com/drowe67/codec2.git ./codec2
|
||||
|
||||
WORKDIR /app/FreeDATA/freedata_server/lib/codec2
|
||||
|
||||
RUN mkdir build_linux
|
||||
|
||||
WORKDIR /app/FreeDATA/freedata_server/lib/codec2/build_linux
|
||||
|
||||
RUN cmake .. && make codec2 -j4
|
||||
|
||||
################################################################################
|
||||
# Final image
|
||||
################################################################################
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
ENV PATH="/app/FreeDATA-hamlib/bin:/app/FreeDATA/venv/bin:$PATH"
|
||||
|
||||
ENV FREEDATA_CONFIG=/data/config.ini
|
||||
ENV FREEDATA_DATABASE=/data/freedata-messages.db
|
||||
ENV HOME=/home/freedata
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=server /app ./
|
||||
COPY --from=frontend /src/dist/ ./FreeDATA/freedata_gui/dist/
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN mkdir -p /data && \
|
||||
cp FreeDATA/freedata_server/config.ini.example /data/config.ini && \
|
||||
apt-get update && \
|
||||
apt-get install --upgrade -y \
|
||||
portaudio19-dev \
|
||||
alsa-utils \
|
||||
libasound2 \
|
||||
libasound2-plugins \
|
||||
pulseaudio \
|
||||
pulseaudio-utils && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd --create-home --home-dir $HOME freedata \
|
||||
&& usermod -aG audio,pulse,pulse-access freedata \
|
||||
&& chown -R freedata:freedata $HOME
|
||||
|
||||
USER freedata
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
|
@ -0,0 +1,124 @@
|
|||
# Running FreeDATA in Docker
|
||||
|
||||
This image was built to allow FreeDATA to be run on MacOS. These instructions are for MacOS, but should work on any platform that supports Docker.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* An install of Docker (eg. [Docker Desktop for MacOS](https://docs.docker.com/desktop/setup/install/mac-install/)).
|
||||
* Some familiarity with the command line (eg: via `Terminal.app`).
|
||||
* [Brew](https://brew.sh/) - I've tried to avoid this as a requirement but it is the easiest way to install `pulseaudio` on MacOS.
|
||||
|
||||
## Setting up
|
||||
|
||||
### PulseAudio
|
||||
|
||||
A lot of this is taken from [this gist](https://gist.github.com/seongyongkim/b7d630a03e74c7ab1c6b53473b592712) and [this Dockerfile](https://github.com/KEINOS/Dockerfile_of_Speaker-Test-for-MacHost/blob/master/Dockerfile)
|
||||
|
||||
Firstly, install.
|
||||
|
||||
```bash
|
||||
brew install pulseaudio
|
||||
```
|
||||
|
||||
Now run the daemon.
|
||||
```bash
|
||||
pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon
|
||||
```
|
||||
|
||||
Confirm it is running.
|
||||
```bash
|
||||
pulseaudio --check -v
|
||||
```
|
||||
|
||||
Setup the audio output, this will list your audio output devices. The `*` will show the default output.
|
||||
```bash
|
||||
pacmd list-sinks | grep -e 'name:' -e 'index:' -e 'card:'
|
||||
```
|
||||
|
||||
If you need to change your default output then this can be done by specifying the index:
|
||||
```bash
|
||||
pacmd set-default-sink 1
|
||||
```
|
||||
|
||||
As will above, setup the the audio source.
|
||||
```bash
|
||||
pacmd list-sources | grep -e 'name:' -e 'index:' -e 'card:'
|
||||
```
|
||||
|
||||
Any updates to sources can be triggered with:
|
||||
```bash
|
||||
pacmd set-default-source 1
|
||||
```
|
||||
|
||||
### FreeDATA Image
|
||||
|
||||
This can be run in one of two ways. By running the docker image with a long command line or via `docker compose`. Lets start with the long command line.
|
||||
|
||||
On first run, this will copy the sample config file into the `./freedata-data` directory. This can be edited to suit your needs via the GUI. However, to get the GUI to run you will need to update the `NETWORK` section in `config.ini` file to be:
|
||||
|
||||
```bash
|
||||
[NETWORK]
|
||||
modemaddress = 0.0.0.0
|
||||
modemport = 5050
|
||||
```
|
||||
|
||||
Now we can start the server.
|
||||
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
-v ./freedata-data:/data
|
||||
-e PULSE_SERVER=host.docker.internal
|
||||
-v /$HOME/.config/pulse:/home/freedata/.config/pulse \
|
||||
-p 5050:5050 \
|
||||
--name freedata \
|
||||
ghcr.io/dj2ls/freedata:latest
|
||||
```
|
||||
|
||||
If you'd like to start a `rigctld` instance in the container (see [the wiki](https://wiki.freedata.app/en/usage/radio-control#hamlib-rigctld-commands)), the arguments can be provided with the `RIGCTL_ARGS` environment variable. In the examples below I'm passing a model for a FlexRadio at IP `192.168.0.10` listening on port `6701`:
|
||||
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
-v ./freedata-data:/data
|
||||
-e PULSE_SERVER=host.docker.internal
|
||||
-e RIGCTLD_ARGS="--model=2036 --port=4532 --rig-file=192.168.0.10:6701"
|
||||
-v /$HOME/.config/pulse:/home/freedata/.config/pulse \
|
||||
-p 5050:5050 \
|
||||
--name freedata \
|
||||
ghcr.io/dj2ls/freedata:latest
|
||||
```
|
||||
|
||||
A slightly more tidy method of provding the same config is via `docker compose`. Create a `docker-compose.yml` file with the following content:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
freedata:
|
||||
container_name: freedata
|
||||
image: ghcr.io/dj2ls/freedata:latest
|
||||
pull_policy: always
|
||||
volumes:
|
||||
- ./freedata-data:/data
|
||||
- /$HOME/.config/pulse:/home/freedata/.config/pulse
|
||||
environment:
|
||||
- PULSE_SERVER=host.docker.internal
|
||||
- RIGCTLD_ARGS=--model=2036 --port=4532 --rig-file=192.168.0.10:6701
|
||||
ports:
|
||||
- 5050:5050
|
||||
```
|
||||
|
||||
This can then be run with:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
And its logs viewed with:
|
||||
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Once the server is running, you can access the GUI by visiting `http://localhost:5050/gui` in your browser.
|
||||
|
||||
You will need to set up your audio device and radio config.
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "Starting pulseaudio"
|
||||
pulseaudio --exit-idle-time=-1 --daemon &
|
||||
|
||||
if [ -z "${RIGCTLD_ARGS+x}" ]; then
|
||||
echo "No RIGCTLD_ARGS set, not starting rigctld"
|
||||
else
|
||||
echo "Starting rigctld with args ${RIGCTLD_ARGS}"
|
||||
rigctld ${RIGCTLD_ARGS} &
|
||||
fi
|
||||
|
||||
echo "Starting FreeDATA server"
|
||||
python3 /app/FreeDATA/freedata_server/server.py
|
Loading…
Reference in New Issue