Skip to content

Commit 2e782b9

Browse files
committed
docker: add Dockerfile
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
1 parent b1e9c57 commit 2e782b9

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target
2+
Dockerfile
3+
.dockerignore
4+
.git
5+
.gitignore

docker/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Build image
2+
FROM ghcr.io/rust-lang/rust:nightly-bookworm as build
3+
4+
RUN apt-get update && \
5+
apt-get install -y build-essential \
6+
cmake \
7+
libpcre2-dev \
8+
protobuf-compiler
9+
10+
WORKDIR /usr/src/holo
11+
COPY .. .
12+
RUN cargo build --features zebra-8-4-compat --release
13+
14+
# Final base
15+
FROM debian:bookworm-slim
16+
17+
RUN apt-get update && \
18+
apt-get install -y frr \
19+
ifupdown \
20+
iputils-ping \
21+
less \
22+
tcpdump \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
RUN mkdir -p /var/run/holo
26+
RUN chown frr:frr /var/run/holo
27+
28+
# Define Bash aliases
29+
RUN echo "alias holo-cli-show='holo-cli -c \"show state xpath /ietf-routing:routing format json\"'" >> /root/.bashrc
30+
RUN echo "alias ipr='ip -4 ro ; ip -6 ro ; ip -M ro'" >> /root/.bashrc
31+
32+
COPY --from=build /usr/src/holo/holo-daemon/holod.toml /etc/holod.toml
33+
COPY --from=build /usr/src/holo/target/release/holod /usr/local/sbin/
34+
COPY --from=build /usr/src/holo/target/release/holo-cli /usr/local/sbin/
35+
36+
ENV RUST_BACKTRACE=1
37+
ENV RUST_LOG=holo=debug
38+
39+
COPY docker/docker-start /usr/src/docker-start
40+
CMD ["/usr/src/docker-start"]

docker/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Docker
2+
3+
# Build
4+
5+
To build the Docker image, navigate to the parent directory and run the following command:
6+
```
7+
docker build -t holo -f docker/Dockerfile .
8+
```
9+
10+
# Running
11+
12+
To run the container in the background, use the following command:
13+
```
14+
docker run -itd --privileged --name holo holo
15+
```
16+
17+
To access Holo's CLI, use the following command:
18+
```
19+
docker exec -it holo holo-cli

docker/docker-start

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
service frr start
4+
holod 2>> /tmp/holod.err

0 commit comments

Comments
 (0)