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
49 changes: 49 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ---- Build stage ----
FROM alpine:latest AS builder

# Install build tools and dependencies
RUN apk add --no-cache \
build-base \
git \
json-c-dev \
libmnl-dev

# ---------------------------------
# Build libsavl as a static library
# ---------------------------------
WORKDIR /deps
RUN git clone https://github.com/ipilcher/libsavl.git
WORKDIR /deps/libsavl
RUN mkdir -p /usr/local/include \
&& gcc -std=gnu99 -O3 -Wall -Wextra -c savl.c -o savl.o \
&& ar rcs libsavl.a savl.o \
&& cp libsavl.a /usr/local/lib/ \
&& cp savl.h /usr/local/include/

# ---------------------------------
# Build fdf
# ---------------------------------
WORKDIR /app
RUN git clone https://github.com/ipilcher/fdf.git .
WORKDIR /app

# Link against static libsavl
RUN gcc -std=gnu99 -O3 -Wall -Wextra \
-I/usr/local/include -I/usr/include/json-c \
src/*.c \
-L/usr/local/lib -lsavl -ljson-c -lmnl \
-o fdfd


# ---- Runtime stage ----
FROM alpine:latest

# Runtime dependencies
RUN apk add --no-cache \
json-c \
libmnl \
libstdc++

COPY --from=builder /app/fdfd /usr/local/bin/fdfd
ENTRYPOINT ["fdfd"]
CMD ["--help"]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,3 +570,22 @@ Feb 26 17:33:49 asterisk.penurio.us fdfd[18317]: INFO: filter.c:214: Loaded filt
Feb 26 17:33:49 asterisk.penurio.us fdfd[18317]: INFO: filter.c:214: Loaded filter (mdns_answe..." ]
Hint: Some lines were ellipsized, use -l to show in full.
```

## Docker

If you would like to run this as a container

1. ```docker build -t fdf .```
2. ```docker run --name fdf fdf```

```fdfd options:
-l | --syslog: log messages to syslog
-e | --stderr: log messages to stderr
-d | --debug: log debug level messages
-p | --pktlog: enable verbose packet logging
-c | --config: specify configuration file
-h | --help: show this message and exit
```

From there you may wish to pass arguments to the run command, run it through compose as a daemon, etc.