Skip to content

Commit

Permalink
minimize the docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Mar 24, 2023
1 parent b1b3d94 commit a4e6635
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ build:

clean:
make -C src clean

install:
sudo apt update
sudo apt-get install -y --no-install-recommends \
libelf1 libelf-dev zlib1g-dev \
make clang llvm
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,53 @@ Click the "Use this template" button on the GitHub repository page to create a n

Clone your newly created repository to your local machine:

```sh
git clone https://github.com/your_username/your_new_repository.git --recursive
```
git clone https://github.com/your_username/your_new_repository.git

Or after clone the repo, you can update the git submodule with following commands:

```sh
git submodule update --init --recursive
```

### **3. Install dependencies**

For dependencies, it varies from distribution to distribution. You can refer to shell.nix and 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.

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

To build the project, run the following command:

```
```sh
make build
```

This will compile your code and create the necessary binaries.
This will compile your code and create the necessary binaries. You can you the `Github Code space` or `Github Action` to build the project as well.

### ***Run the Project***

You can run the binary with:

```console
sudo src/bootstrap
```

Or with Github Packages locally:

```console
docker run --rm -it --privileged -v $(pwd):/examples ghcr.io/eunomia-bpf/libbpf-template:latest
```

### **7. GitHub Actions**

Expand Down
13 changes: 4 additions & 9 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ FROM ubuntu:22.04
WORKDIR /root/
COPY . /root/

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
libelf1 libelf-dev zlib1g-dev libclang-13-dev \
make git clang llvm pkg-config build-essential && \
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/*

ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/root/src/bootstrap"]

0 comments on commit a4e6635

Please sign in to comment.