mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2025-12-23 22:29:01 -05:00
feat: docker container
This commit is contained in:
12
.dockerignore
Normal file
12
.dockerignore
Normal file
@@ -0,0 +1,12 @@
|
||||
/target
|
||||
.git
|
||||
.gitignore
|
||||
.github
|
||||
*.md
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
LICENSE-APACHE
|
||||
LICENSE-MIT
|
||||
*.sh
|
||||
.editorconfig
|
||||
.gitattributes
|
||||
24
.github/workflows/package.yml
vendored
24
.github/workflows/package.yml
vendored
@@ -322,3 +322,27 @@ jobs:
|
||||
name: msi-${{ matrix.arch }}
|
||||
path: artifacts/
|
||||
if-no-files-found: error
|
||||
docker:
|
||||
name: Docker Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
ghcr.io/${{ github.repository }}:${{ github.sha }}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -55,6 +55,5 @@ $RECYCLE.BIN/
|
||||
*.lnk
|
||||
|
||||
### Custom... ###
|
||||
Dockerfile
|
||||
lcov.info
|
||||
*.pcap
|
||||
*.pcap
|
||||
|
||||
49
Dockerfile
Normal file
49
Dockerfile
Normal file
@@ -0,0 +1,49 @@
|
||||
FROM rust:1.85-slim AS builder
|
||||
|
||||
# Install sniffnet build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libfreetype6-dev \
|
||||
libexpat1-dev \
|
||||
libpcap-dev \
|
||||
libasound2-dev \
|
||||
libfontconfig1-dev \
|
||||
libgtk-3-dev \
|
||||
pkg-config \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create a new empty shell project
|
||||
WORKDIR /usr/src/sniffnet
|
||||
COPY . .
|
||||
|
||||
# Build for release
|
||||
RUN cargo build --release
|
||||
|
||||
# Runtime stage
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
# Install runtime dependencies including Wayland
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libfreetype6 \
|
||||
libexpat1 \
|
||||
libpcap0.8 \
|
||||
libasound2 \
|
||||
libfontconfig1 \
|
||||
libgtk-3-0 \
|
||||
libwayland-client0 \
|
||||
libwayland-cursor0 \
|
||||
libwayland-egl1 \
|
||||
libxkbcommon0 \
|
||||
mesa-utils \
|
||||
libegl1 \
|
||||
libvulkan1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the built binary
|
||||
COPY --from=builder /usr/src/sniffnet/target/release/sniffnet /usr/local/bin/sniffnet
|
||||
|
||||
# Set environment variables for Wayland
|
||||
ENV GDK_BACKEND=wayland
|
||||
ENV WAYLAND_DISPLAY=$WAYLAND_DISPLAY
|
||||
ENV XDG_RUNTIME_DIR=/tmp
|
||||
|
||||
ENTRYPOINT ["sniffnet"]
|
||||
Reference in New Issue
Block a user