Skip to content

Commit 3c6e3b6

Browse files
committed
Initial commit
0 parents  commit 3c6e3b6

8 files changed

Lines changed: 934 additions & 0 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "Python 3",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/python:3-3.11-trixie",
7+
8+
// Features to add to the dev container. More info: https://containers.dev/features.
9+
// "features": {},
10+
11+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12+
// "forwardPorts": [],
13+
14+
// Use 'postCreateCommand' to run commands after the container is created.
15+
"postCreateCommand": "pip3 install --user -r requirements.txt",
16+
17+
// Configure tool-specific properties.
18+
// "customizations": {},
19+
20+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
21+
"remoteUser": "root"
22+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Multi-Arch Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Log in to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKER_USERNAME }}
26+
password: ${{ secrets.DOCKER_PASSWORD }}
27+
28+
- name: Build and push multi-arch image
29+
uses: docker/build-push-action@v5
30+
with:
31+
context: .
32+
push: true
33+
platforms: linux/amd64,linux/arm64
34+
tags: |
35+
${{ secrets.DOCKER_USERNAME }}/network-utils-ws:latest
36+
${{ secrets.DOCKER_USERNAME }}/network-utils-ws:${{ github.sha }}

.gitignore

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# === .gitignore for Global/VisualStudioCode (https://raw.githubusercontent.com/github/gitignore/main/Global/VisualStudioCode.gitignore) ===
2+
3+
# Visual Studio Code
4+
.vscode/*
5+
!.vscode/settings.json
6+
!.vscode/tasks.json
7+
!.vscode/launch.json
8+
!.vscode/extensions.json
9+
!.vscode/*.code-snippets
10+
!*.code-workspace
11+
12+
# Built Visual Studio Code Extensions
13+
*.vsix
14+
15+
16+
# === .gitignore for Python (https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore) ===
17+
18+
# Byte-compiled / optimized / DLL files
19+
__pycache__/
20+
*.py[codz]
21+
*$py.class
22+
23+
# C extensions
24+
*.so
25+
26+
# Distribution / packaging
27+
.Python
28+
build/
29+
develop-eggs/
30+
dist/
31+
downloads/
32+
eggs/
33+
.eggs/
34+
lib/
35+
lib64/
36+
parts/
37+
sdist/
38+
var/
39+
wheels/
40+
share/python-wheels/
41+
*.egg-info/
42+
.installed.cfg
43+
*.egg
44+
MANIFEST
45+
46+
# PyInstaller
47+
# Usually these files are written by a python script from a template
48+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
49+
*.manifest
50+
*.spec
51+
52+
# Installer logs
53+
pip-log.txt
54+
pip-delete-this-directory.txt
55+
56+
# Unit test / coverage reports
57+
htmlcov/
58+
.tox/
59+
.nox/
60+
.coverage
61+
.coverage.*
62+
.cache
63+
nosetests.xml
64+
coverage.xml
65+
*.cover
66+
*.py.cover
67+
*.lcov
68+
.hypothesis/
69+
.pytest_cache/
70+
cover/
71+
72+
# Translations
73+
*.mo
74+
*.pot
75+
76+
# Django stuff:
77+
*.log
78+
local_settings.py
79+
db.sqlite3
80+
db.sqlite3-journal
81+
82+
# Flask stuff:
83+
instance/
84+
.webassets-cache
85+
86+
# Scrapy stuff:
87+
.scrapy
88+
89+
# Sphinx documentation
90+
docs/_build/
91+
92+
# PyBuilder
93+
.pybuilder/
94+
target/
95+
96+
# Jupyter Notebook
97+
.ipynb_checkpoints
98+
99+
# IPython
100+
profile_default/
101+
ipython_config.py
102+
103+
# pyenv
104+
# For a library or package, you might want to ignore these files since the code is
105+
# intended to run in multiple environments; otherwise, check them in:
106+
# .python-version
107+
108+
# pipenv
109+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
110+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
111+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
112+
# install all needed dependencies.
113+
# Pipfile.lock
114+
115+
# UV
116+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
117+
# This is especially recommended for binary packages to ensure reproducibility, and is more
118+
# commonly ignored for libraries.
119+
# uv.lock
120+
121+
# poetry
122+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
123+
# This is especially recommended for binary packages to ensure reproducibility, and is more
124+
# commonly ignored for libraries.
125+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
126+
# poetry.lock
127+
# poetry.toml
128+
129+
# pdm
130+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
131+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
132+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
133+
# pdm.lock
134+
# pdm.toml
135+
.pdm-python
136+
.pdm-build/
137+
138+
# pixi
139+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
140+
# pixi.lock
141+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
142+
# in the .venv directory. It is recommended not to include this directory in version control.
143+
.pixi/*
144+
!.pixi/config.toml
145+
146+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
147+
__pypackages__/
148+
149+
# Celery stuff
150+
celerybeat-schedule*
151+
celerybeat.pid
152+
153+
# Redis
154+
*.rdb
155+
*.aof
156+
*.pid
157+
158+
# RabbitMQ
159+
mnesia/
160+
rabbitmq/
161+
rabbitmq-data/
162+
163+
# ActiveMQ
164+
activemq-data/
165+
166+
# SageMath parsed files
167+
*.sage.py
168+
169+
# Environments
170+
.env
171+
.envrc
172+
.venv
173+
env/
174+
venv/
175+
ENV/
176+
env.bak/
177+
venv.bak/
178+
179+
# Spyder project settings
180+
.spyderproject
181+
.spyproject
182+
183+
# Rope project settings
184+
.ropeproject
185+
186+
# mkdocs documentation
187+
/site
188+
189+
# mypy
190+
.mypy_cache/
191+
.dmypy.json
192+
dmypy.json
193+
194+
# Pyre type checker
195+
.pyre/
196+
197+
# pytype static type analyzer
198+
.pytype/
199+
200+
# Cython debug symbols
201+
cython_debug/
202+
203+
# PyCharm
204+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
205+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
206+
# and can be added to the global gitignore or merged into this file. For a more nuclear
207+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
208+
# .idea/
209+
210+
# Abstra
211+
# Abstra is an AI-powered process automation framework.
212+
# Ignore directories containing user credentials, local state, and settings.
213+
# Learn more at https://abstra.io/docs
214+
.abstra/
215+
216+
# Visual Studio Code
217+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
218+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
219+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
220+
# you could uncomment the following to ignore the entire vscode folder
221+
# .vscode/
222+
# Temporary file for partial code execution
223+
tempCodeRunnerFile.py
224+
225+
# Ruff stuff:
226+
.ruff_cache/
227+
228+
# PyPI configuration file
229+
.pypirc
230+
231+
# Marimo
232+
marimo/_static/
233+
marimo/_lsp/
234+
__marimo__/
235+
236+
# Streamlit
237+
.streamlit/secrets.toml

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ---- Base image ----
2+
FROM python:3.11-slim
3+
4+
# ---- Environment ----
5+
ENV PYTHONDONTWRITEBYTECODE=1
6+
ENV PYTHONUNBUFFERED=1
7+
8+
# ---- Install system deps ----
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
curl \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# ---- Install Python deps ----
14+
WORKDIR /app
15+
COPY requirements.txt .
16+
RUN pip install --no-cache-dir -r requirements.txt
17+
18+
# ---- Copy application ----
19+
COPY . .
20+
21+
# ---- Expose port ----
22+
EXPOSE 8000
23+
24+
# ---- Healthcheck ----
25+
# Uses curl to hit the FastAPI health endpoint
26+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
27+
CMD curl -f http://localhost:8000/health || exit 1
28+
29+
# ---- Start server ----
30+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

LICENCE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 sharevb
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)