-
-
Notifications
You must be signed in to change notification settings - Fork 681
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
feat: docker container #735
base: main
Are you sure you want to change the base?
Conversation
@GyulyVGC this works on my feroda 41 using following steps: docker build -t sniffnet . docker run -it \
--net=host \
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
-e XDG_RUNTIME_DIR=/tmp \
-e RUST_BACKTRACE=full \
-e ICED_BACKEND=tiny-skia \
--cap-add=NET_ADMIN \
--cap-add=NET_RAW \
sniffnet I created a draft because I think it would be good to test some things a bit more e.g. on different linux versions maybe and with and without gpu. And certainly add some documentation because this approach is not OS agnostic for example if you would like to use the container on windows or mac it might be a bit more challenging as you would need to have wayland running on mac. Please let me know how you want to deal with this. |
Thank you very much 🔥 I think before testing it'd be nice to make this as platform agnostic as possible, as it's one of the main purposes is the container. |
@GyulyVGC regarding platform agnostic. AFAICT docker images ARE platform dependent and can't be made platform agnostic. That said I've altered the github workflow platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 I've also tested using docker buildx locally like this: docker buildx build --platform linux/arm64 -t domcyrus/sniffnet:arm64 --load .
2025/02/23 12:21:35 in: []string{}
2025/02/23 12:21:35 Parsed entitlements: []
[+] Building 3300.1s (15/15) FINISHED docker-container:multiarch-builder
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 865B 0.0s
=> [internal] load metadata for docker.io/library/rust:1.85-slim 1.4s
=> [internal] load metadata for docker.io/library/debian:bookworm-slim 1.2s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 221B 0.0s
=> [builder 1/5] FROM docker.io/library/rust:1.85-slim@sha256:c46b18afcf69c93b00781d3108addc0f5d5f113cd69faccb02e1c22b470e6b3d 9.8s
=> => resolve docker.io/library/rust:1.85-slim@sha256:c46b18afcf69c93b00781d3108addc0f5d5f113cd69faccb02e1c22b470e6b3d 0.0s
=> => sha256:809ab4ce3403ef1471e13068ac77fcbcabb76460a40a555a3a348b1b0a69bf3b 323.01MB / 323.01MB 3.6s
=> => extracting sha256:809ab4ce3403ef1471e13068ac77fcbcabb76460a40a555a3a348b1b0a69bf3b 6.1s
=> [stage-1 1/3] FROM docker.io/library/debian:bookworm-slim@sha256:40b107342c492725bc7aacbe93a49945445191ae364184a6d24fedb2817 1.7s
=> => resolve docker.io/library/debian:bookworm-slim@sha256:40b107342c492725bc7aacbe93a49945445191ae364184a6d24fedb28172f6f7 0.0s
=> => sha256:4d2547c084994a809c138e688fbe4ee14eedbc6e2defc5b1c680edd16e291473 28.04MB / 28.04MB 0.5s
=> => extracting sha256:4d2547c084994a809c138e688fbe4ee14eedbc6e2defc5b1c680edd16e291473 1.1s
=> [internal] load build context 0.7s
=> => transferring context: 121.28MB 0.6s
=> [stage-1 2/3] RUN apt-get update && apt-get install -y libfreetype6 libexpat1 libpcap0.8 libasound2 lib 85.9s
=> [builder 2/5] RUN apt-get update && apt-get install -y libfreetype6-dev libexpat1-dev libpcap-dev libasoun 167.8s
=> [builder 3/5] WORKDIR /usr/src/sniffnet 0.2s
=> [builder 4/5] COPY . . 0.4s
=> [builder 5/5] RUN cargo build --release 3112.9s
=> [stage-1 3/3] COPY --from=builder /usr/src/sniffnet/target/release/sniffnet /usr/local/bin/sniffnet 0.2s
=> exporting to docker image format 7.3s
=> => exporting layers 4.2s
=> => exporting manifest sha256:74b4f8bc6ecf8981f29cc2e7e50c1d85de93ebd62e8b423a23c76e838859db56 0.0s
=> => exporting config sha256:7d947c4124756bf3cd67e67cc51e490da4308471d06f5fb0518aa819616d7bd2 0.0s
=> => sending tarball 3.1s
=> importing to docker 2.6s
=> => loading layer 6917fb72c784 53.11MB / 53.11MB 2.6s
=> => loading layer b88da0c93ef3 18.99MB / 18.99MB 0.3s It took a bit of time to compile it ;) but it looks alright to me. Let me know what you think about this approach. |
Thank you very much again. I'm pretty busy these days, will check and test as soon as I get some time. |
Add a Dockerfile and job to build it during package workflow.
#69