Skip to content

Conversation

@Satvik-Singh192
Copy link
Contributor

📘 Description

This pull request containerizes the Python firewall tool using Docker, fulfilling the requirements of issue #5.
It simplifies deployment and ensures a consistent runtime environment across all systems, handling all dependencies and network permissions automatically.

✅ Key Changes

1. Dockerfile

  • Uses the lightweight python:3.10-slim base image.
  • Installs gcc and build-essential to compile the netifaces package.
  • Installs all runtime dependencies from requirements_docker.txt.
  • Removes build tools at the end to keep the image slim.

2. docker-compose.yml

  • Configured with:
    • cap_add: [ NET_ADMIN ] → required for managing iptables
    • network_mode: host → needed to inspect/monitor host network interfaces
  • Runs the firewall container with correct privileges.

3. entrypoint.sh

  • New startup script.
  • Automatically checks for firewall_config.json.
    • If missing, runs:
      python main.py --create-config
  • Ensures the application always has a valid configuration before launching.

4. .dockerignore

  • Excludes:
    • venv/
    • __pycache__/
    • Build artifacts
  • Reduces build context size and speeds up Docker builds.

5. requirements_docker.txt

  • Contains only runtime dependencies.
  • Development tools are separated to keep Docker images lightweight.

🚀 How to Run

To build and run the firewall:

docker-compose run --rm firewall

🔢 Semver Changes

  • Patch (bug fix)
  • Minor (new features, no breaking changes)
  • Major (breaking changes)

🔗 Issues

Closes #5


✅ Checklist

  • I have read the Contributing Guidelines.

@Satvik-Singh192
Copy link
Contributor Author

@utkarshkgithub please review my pull request sir

@Satvik-Singh192
Copy link
Contributor Author

@utkarshkgithub sir, please review my pull request, thanks

@utkarshkgithub utkarshkgithub merged commit 7b81031 into OPCODE-Open-Spring-Fest:main Nov 9, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants