Skip to content

Commit f986660

Browse files
committed
Adding github actions and fixes to README and docker file.
1 parent 2de0aa1 commit f986660

3 files changed

Lines changed: 98 additions & 20 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
pull_request:
10+
branches:
11+
- main
12+
workflow_dispatch:
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}
17+
18+
jobs:
19+
build-and-push:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
packages: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: recursive
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Log in to GitHub Container Registry
35+
if: github.event_name != 'pull_request'
36+
uses: docker/login-action@v3
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Extract metadata (tags, labels)
43+
id: meta
44+
uses: docker/metadata-action@v5
45+
with:
46+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47+
tags: |
48+
type=ref,event=branch
49+
type=ref,event=pr
50+
type=semver,pattern={{version}}
51+
type=semver,pattern={{major}}.{{minor}}
52+
type=semver,pattern={{major}}
53+
type=sha,prefix={{branch}}-
54+
type=raw,value=latest,enable={{is_default_branch}}
55+
56+
- name: Build and push Docker image
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: ./cyphal-tools
60+
file: ./cyphal-tools/Dockerfile
61+
push: ${{ github.event_name != 'pull_request' }}
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
cache-from: type=gha
65+
cache-to: type=gha,mode=max

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A docker container to use Yakut from OpenCyphal.org and github.com/opencyphal an
44

55
## Setup
66

7-
Check out the git submodules to get the latest wire shark filters and the latest Cyphal Regulated Messages.
7+
Check out the git submodules to get the latest wire shark filters and the latest Cyphal Regulated Messages.
88

99
```bash
1010
git submodule init
@@ -13,32 +13,35 @@ git submodule update
1313

1414
## Building
1515

16-
I use finch locally to build on my Mac.
16+
I use finch locally to build on my Mac.
1717

1818
```bash
19-
finch build cyphal-tools cyphal-tools
19+
finch build cyphal-tools --tag docker-opencyphal-debug-tools
2020
```
2121

2222
On Linux you can use docker
2323

2424
```bash
25-
docker buildx build cyphal-tools -t cyphal-tools
25+
docker buildx build cyphal-tools -t docker-opencyphal-debug-tools
2626
```
2727

2828
## Running
2929

30+
Use native host to get network access for Cyphal/UDP traffic:
31+
3032
```bash
31-
finch run -it --network host --cap-add=NET_RAW --cap-add=NET_ADMIN cyphal-tools
33+
finch run -it --network host --cap-add=NET_RAW --cap-add=NET_ADMIN docker-opencyphal-debug-tools
3234
```
3335

3436
or
3537

3638
```bash
37-
docker run -it --net host cyphal-tools
39+
docker run -it --net host docker-opencyphal-debug-tools
3840
```
3941

40-
You can use both the `tshark` and `yakut` tools in the container to observer multicast Cyphal/UDP
41-
traffic.
42+
You can either run the container with `--network host` to get direct network access for Cyphal/UDP traffic or expose the UDP port 9382 to access it from outside the container `-p 9382:9382`.
43+
44+
You can use both the `tshark` and `yakut` tools in the container to observe multicast Cyphal/UDP traffic.
4245

4346
### Terminal Shark
4447

@@ -62,6 +65,7 @@ Capturing on 'eth0'
6265
```
6366

6467
### Yakut
68+
6569
See Yakut's readme for more information: [here](https://github.com/opencyphal/yakut)
6670

6771
Be sure to set `UAVCAN__NODE__ID` and `UAVCAN__UDP__IFACE` as appropriate before running `yakut`.

cyphal-tools/Dockerfile

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# We use the base Ubuntu image on ECR
22
FROM ubuntu:22.04
33

4-
ENV DEBIAN_FRONTEND noninteractive
4+
ENV DEBIAN_FRONTEND=noninteractive
55

66
# Change the default shell to /bin/bash
77
RUN chsh -s /bin/bash root
@@ -18,25 +18,32 @@ RUN apt install -y debconf
1818
RUN echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-selections
1919
RUN apt install -y --reinstall resolvconf
2020
RUN apt install -y ubuntu-minimal dbus usbutils can-utils tcpdump tshark screen tmux joe bash-completion autoconf libtool \
21-
python3.11 python3-pip python3-dev
21+
python3.11 python3-pip python3-dev
2222
RUN apt clean && rm -r /var/lib/apt/lists/*
2323

2424
# Pips to install
2525
RUN python3 -m pip install --upgrade pip
26-
RUN python3 -m pip install -Iv pyserial yakut
26+
RUN python3 -m pip install -Iv pyserial yakut==0.13.0
2727
RUN python3 -m pip check
2828
RUN rm -rf /root/.cache/pip/*
2929

3030
# Create the working directory for processing cyphal DSDL and Yakut
3131
WORKDIR /app
32-
33-
ENV CYPHAL_PATH /app/cyphal/dsdl
34-
ENV YAKUT_PATH ${CYPHAL_PATH}/../generated
35-
RUN mkdir -p ${YAKUT_PATH} ${DSDL_PATH}
36-
COPY public_regulated_data_types/uavcan ${CYPHAL_PATH}/uavcan
37-
RUN yakut -v compile -O ${YAKUT_PATH} ${CYPHAL_PATH}/uavcan
38-
ENV DSDL_PATH ${CYPHAL_PATH}/uavcan
39-
ENV PYTHONPATH ${YAKUT_PATH}
32+
# The root of all the cyphal files
33+
ENV CYPHAL_ROOT=/app/cyphal
34+
# Directory where DSDL files are located
35+
ENV DSDL_PATH=${CYPHAL_ROOT}/dsdl
36+
# Directory where Yakut will generate Python modules from DSDL
37+
ENV YAKUT_PATH=${CYPHAL_ROOT}/generated
38+
# When running Yakut, it needs to find the generated Python modules
39+
ENV PYTHONPATH=${YAKUT_PATH}
40+
# Where Cyphal can find the dsdl to compile automatically
41+
ENV CYPHAL_PATH=${DSDL_PATH}/uavcan
42+
# Used by Nunavut as well
43+
ENV DSDL_INCLUDE_PATH=${DSDL_PATH}/uavcan
44+
RUN mkdir -p ${CYPHAL_ROOT} ${DSDL_PATH} ${YAKUT_PATH} ${DSDL_INCLUDE_PATH}
45+
COPY public_regulated_data_types/uavcan ${DSDL_PATH}/uavcan
46+
RUN yakut -v compile -O ${YAKUT_PATH} ${DSDL_PATH}/uavcan
4047

4148
COPY wireshark_plugins/*.lua /root/.local/lib/wireshark/plugins/
4249
RUN setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap
@@ -45,7 +52,9 @@ RUN setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap
4552
RUN lsb_release -a
4653

4754
# Cyphal UDP Port
48-
EXPOSE 9382/UDP
55+
EXPOSE 9382/udp
4956

5057
# Check that it exists and show the version in the log
58+
ENV UAVCAN__NODE__ID=126
59+
ENV UAVCAN__UDP__IFACE=127.0.0.1
5160
RUN yakut --version

0 commit comments

Comments
 (0)