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

feat: docker container #735

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/target
.git
.gitignore
.github
*.md
Dockerfile
.dockerignore
LICENSE-APACHE
LICENSE-MIT
*.sh
.editorconfig
.gitattributes
30 changes: 30 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,33 @@ jobs:
name: msi-${{ matrix.arch }}
path: artifacts/
if-no-files-found: error
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- 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:
context: .
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,5 @@ $RECYCLE.BIN/
*.lnk

### Custom... ###
Dockerfile
lcov.info
*.pcap
*.pcap
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM rust:1.85-slim AS builder

# Install build dependencies for both X11 and Wayland
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/*

WORKDIR /usr/src/sniffnet
COPY . .

RUN cargo build --release

# Runtime stage
FROM debian:bookworm-slim

# Install runtime dependencies for both X11 and Wayland
RUN apt-get update && apt-get install -y \
libfreetype6 \
libexpat1 \
libpcap0.8 \
libasound2 \
libfontconfig1 \
libgtk-3-0 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/src/sniffnet/target/release/sniffnet /usr/local/bin/sniffnet

ENTRYPOINT ["sniffnet"]