Skip to content
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git/
README.md
.vscode/
.dockerignore
README.md
.git
72 changes: 72 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ "main" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Setup buildx
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v1.7.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1.14.1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.0.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2.10.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM tiangolo/uwsgi-nginx-flask:python3.11-2024-01-01

WORKDIR /app

COPY . .

RUN pip3 install --no-cache-dir -r requirements.txt
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Before proceeding, ensure you have the following installed on your system.
- `pip` + `virtualenv`
- `rtl-sdr` package, including `rtl_tcp` and `rtl_power`
- `hackrf_sweep` for the [HackRF](https://github.com/greatscottgadgets/hackrf)
- Optionally `docker`

## Installation and Setup

Expand Down Expand Up @@ -48,6 +49,33 @@ Before starting Rave, make sure that you have the backend tools like rtl_tcp, rt
```
Note: this currently starts the Flask development server. Proper WSGI server support is coming soon.

## Docker

Dockerfile and docker-compose.yml files have been added to the repo.

To build and run application run the following command
```bash
./startContainer.sh
```

Additionally, the Docker image is built with GitHub actions on the main branch.

If you open up the docker-compose.yml and modify this line:

```yml
image: raven
```

to be

```yml
image: ghcr.io/fosatech/raven:latest
```

Then run `docker compose run --publish 5000:5000 raven` to start the container

This bash script will build the docker image from the Docker file and then run the container from the docker compose file.

## Usage

After completing the setup, the Flask application will be running on your local server. You can access it via `localhost:5000/rtl_data`.
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.9'

services:
raven:
image: raven
ports:
- "5000:5000"
entrypoint:
- python
- raven.py
- --host=0.0.0.0
10 changes: 10 additions & 0 deletions startContainer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -x

echo "Building Docker container..."

docker build -t raven .

echo "Starting Docker container..."
docker compose run --publish 5000:5000 raven