From be237a3a1a8111e717e22abc7db1f258b1c9cd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Gavil=C3=A1n?= Date: Sun, 18 Feb 2024 16:25:53 +0100 Subject: [PATCH 1/2] breaking: Run latest version on Docker (Ubuntu 22.04 Homebrew) --- .github/workflows/docker.yml | 45 ++++++++++++++++++++++++++++++++++++ .gitignore | 1 - Dockerfile | 3 +++ docker-compose.yml | 5 ++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..a7501889 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,45 @@ +name: Publish Docker image + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + release: + types: [published] + pull_request: + branches: + - master + paths: + - 'Dockerfile' + - 'Cargo.toml' + - 'Cargo.lock' + - '.github/workflows/docker.yml' + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKER_USERNAME }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: sniffnet/sniffnet + flavor: latest=true + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: ${{ contains(fromJson('["push", "release"]'), github.event_name) }} # Publish to docker registry only on push event or new release. + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2b0ebcd5..d440594c 100644 --- a/.gitignore +++ b/.gitignore @@ -55,5 +55,4 @@ $RECYCLE.BIN/ *.lnk ### Custom... ### -Dockerfile lcov.info \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..c6b31f0e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM homebrew/ubuntu22.04 +RUN brew install sniffnet +RUN ["sniffnet"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..a568f462 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +services: + build-image: + build: . + <<: &default + image: sniffnet \ No newline at end of file From 46df29957ea6d20360aa41125223cc56984633b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Gavil=C3=A1n?= Date: Sun, 18 Feb 2024 16:52:18 +0100 Subject: [PATCH 2/2] breaking: net=host and privileged=true in Docker compose --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index a568f462..f4161458 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,9 @@ services: build-image: build: . + network_mode: "host" + privileged: true + environment: + - DISPLAY <<: &default image: sniffnet \ No newline at end of file