Skip to content

Commit

Permalink
update dockerfile and README
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Mar 24, 2023
1 parent 5119d8a commit 732dc03
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
42 changes: 25 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Dockerfile, and GitHub action, along with all necessary dependencies to simplify

Also, this is a minimal libbpf-rs project, you can read the code to understand how to write ebpf programs using libbpf-rs.



## **Getting Started**

To get started, simply click the "Use this template" button on the GitHub repository page. This will create
Expand All @@ -20,24 +22,9 @@ a new repository in your account with the same files and structure as this templ
Run the following code and you will enter a docker environment with all the basic development dependencies and tools.

```sh
docker build -t any:any .
docker run -it any:any
# or use our image
docker run -it ghcr.io/eunomia-bpf/libbpf-rs-template:latest
```

### Build and Run

Assuming you have installed the required dependencies or are in a docker environment,
the following command will compile the sample ebpf application.

```sh
make
./target/release/runqslower
# or use cargo directly
cargo run
```

## **Features**

This starter template includes the following features:
Expand Down Expand Up @@ -65,8 +52,19 @@ git clone https://github.com/your_username/your_new_repository.git

### **3. Install dependencies**

For dependencies, it varies from distribution to distribution.
You can refer to dockerfile for installation.
For dependencies, it varies from distribution to distribution. You can refer to dockerfile for installation.

On Ubuntu, you may run `make install` or

```sh
sudo apt-get install -y --no-install-recommends \
libelf1 libelf-dev zlib1g-dev \
make clang llvm
```

to install dependencies.

Use `wget -nv -O - https://sh.rustup.rs | sh -s -- -y` to install rust toolchain.

### **4. Build the project**

Expand All @@ -78,6 +76,16 @@ make build

This will compile your code and create the necessary binaries.

### **5. Run the project**

the following command will run the sample ebpf application.

```sh
./target/release/runqslower
# or use cargo directly
cargo run
```

### **7. GitHub Actions**

This template includes two GitHub actions:
Expand Down
15 changes: 4 additions & 11 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ FROM ubuntu:22.04
WORKDIR /root/
COPY . /root/

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
wget pkg-config build-essential zlib1g-dev clang llvm libelf1 libelf-dev && \
apt-get install -y --no-install-recommends ca-certificates && \
update-ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install -y --no-install-recommends libelf1 \
&& rm -rf /var/lib/apt/lists/*

RUN wget -nv -O - https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/root/target/release/runqslower"]

0 comments on commit 732dc03

Please sign in to comment.