Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dockerfile #537

Merged
merged 1 commit into from
May 5, 2024
Merged
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
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,30 @@ jobs:
- name: Publish
run: |
make -f builder/Makefile.release publish SNAPSHOT_VERSION=${{ github.ref_name }}
build-docker-image:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
cfc4n marked this conversation as resolved.
Show resolved Hide resolved
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
cfc4n marked this conversation as resolved.
Show resolved Hide resolved
- name: Update submodule
run: git submodule update --init
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
build-args: VERSION=${{ github.ref_name }}
file: ./builder/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/ecapture:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/ecapture:latest
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ command `./ecapture --help`.
* Linux kernel version >= 4.18 is required.
* Enable BTF [BPF Type Format (BTF)](https://www.kernel.org/doc/html/latest/bpf/btf.html) (Optional, 2022-04-17)

## use docker image

```shell
# pull docker image
docker pull gojue/ecapture:latest
# run
docker run --rm --privileged=true --net=host -v ${HOST_PATH}:${CONTAINER_PATH} gojue/ecapture ARGS
```

## Command line options

> **Note**
Expand Down
10 changes: 10 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ eBPF `Uprobe`/`Traffic Control`实现的各种用户空间/内核空间的数据
* 系统linux kernel版本必须高于4.18。
* 开启BTF [BPF Type Format (BTF)](https://www.kernel.org/doc/html/latest/bpf/btf.html) 支持。 (可选, 2022-04-17)

## docker 容器化运行

```shell
# 拉取镜像
docker pull gojue/ecapture:latest
# 运行
docker run --rm --privileged=true --net=host -v ${宿主机文件路径}:${容器内路径} gojue/ecapture ARGS
```


## 命令参数

> **Note**
Expand Down
11 changes: 10 additions & 1 deletion README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ ELF zip ファイル[リリース](https://github.com/gojue/ecapture/releases)
* Linux kernel version >= 4.18 is required.
* Enable BTF [BPF Type Format (BTF)](https://www.kernel.org/doc/html/latest/bpf/btf.html) (Optional, 2022-04-17)

## docker containerised run

```shell
## イメージをプルする
docker pull gojue/ecapture:latest
# 実行
docker run --rm --privileged=true --net=host -v ${hostファイルパス}:${コンテナ内パス} gojue/ecapture ARGS
```

## コマンドラインオプション

> **注**
Expand Down Expand Up @@ -100,7 +109,7 @@ openssl模块支持3中捕获模式
./ecapture tls -m keylog -keylogfile=openssl_keylog.log
```

也可以直接使用`tshark`软件实时解密展示。
也可以直接使用`Wireshark`软件实时解密展示。
```shell
tshark -o tls.keylog_file:ecapture_masterkey.log -Y http -T fields -e http.file_data -f "port 443" -i eth0
```
Expand Down
39 changes: 39 additions & 0 deletions builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM ubuntu:22.04 as ecapture_builder

# Install Compilers
RUN apt-get update &&\
apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-$(uname -r) make gcc flex bison file wget &&\
# the for-shell built-in instruction does not count as a command
# and the shell used to execute the script is sh by default and not bash.
rm -f /usr/bin/clang && ln -s /usr/bin/clang-14 /usr/bin/clang &&\
rm -f /usr/bin/llc && ln -s /usr/bin/llc-14 /usr/bin/llc &&\
rm -f /usr/bin/llvm-strip && ln -s /usr/bin/llvm-strip-14 /usr/bin/llvm-strip

# Install golang
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "amd64" ]; then\
wget -O go.tar.gz https://golang.google.cn/dl/go1.22.2.linux-${TARGETARCH}.tar.gz; \
else \
echo "unsupport arch" && /bin/false ; \
fi && \
tar -C /usr/local -xzf go.tar.gz && \
export PATH=$PATH:/usr/local/go/bin && \
rm go.tar.gz

ENV PATH="/usr/local/go/bin:${PATH}"

# Build ecapture
COPY ./ /build/ecapture

ARG VERSION

RUN cd /build/ecapture &&\
make clean &&\
make -j $(nproc) all SNAPSHOT_VERSION=${VERSION}_docker

# ecapture release image
FROM alpine:latest as ecapture

COPY --from=ecapture_builder /build/ecapture/bin/ecapture /ecapture

ENTRYPOINT ["/ecapture"]
Loading