Skip to content

Commit 1546726

Browse files
authored
Merge pull request #3 from NitorCreations/docker
Add Docker support
2 parents ff3a024 + 582e4c1 commit 1546726

File tree

5 files changed

+45
-3
lines changed

5 files changed

+45
-3
lines changed

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.13
2+
3+
WORKDIR /app
4+
5+
COPY pyproject.toml vinx_mjpeg_server.py /app
6+
COPY vinx_mjpeg_server /app/vinx_mjpeg_server
7+
8+
RUN pip install --no-cache .
9+
10+
ENTRYPOINT ["python3", "/app/vinx_mjpeg_server.py"]
11+
12+
CMD ["-h"]

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@ there was an issue in fetching the preview image.
1515
This application uses our [pylw3](https://github.com/NitorCreations/pylw3) library under the hood to discover encoders
1616
and [aiohttp](https://github.com/aio-libs/aiohttp) for HTTP.
1717

18+
## Usage
19+
20+
The recommended way is to run the server using the supplied Dockerfile:
21+
22+
```bash
23+
$ docker build -t vinx-mjpeg-server:latest .
24+
$ docker run vinx-mjpeg-server:latest -h
25+
DEBUG:asyncio:Using selector: EpollSelector
26+
usage: vinx-mjpeg-server [-h] --bootstrap-node BOOTSTRAP_NODE
27+
[--fallback-image FALLBACK_IMAGE] [-l LISTEN_ADDRESS]
28+
[-p PORT]
29+
30+
Serves MJPEG streams from VINX HDMI encoder preview images
31+
32+
options:
33+
-h, --help show this help message and exit
34+
--bootstrap-node BOOTSTRAP_NODE
35+
A VINX encoder to use as bootstrap node for auto-
36+
discovery
37+
--fallback-image FALLBACK_IMAGE
38+
A JPEG image to use as fallback when the encoder
39+
preview is unavailable
40+
-l, --listen-address LISTEN_ADDRESS
41+
The address the HTTP server should listen on
42+
-p, --port PORT The port the HTTP should listen on
43+
```
44+
1845
## License
1946

2047
GNU GENERAL PUBLIC LICENSE version 3

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ dependencies = [
1010
"aiohttp"
1111
]
1212

13+
[tool.setuptools]
14+
py-modules = ["vinx-mjpeg-server"]
1315

1416
[tool.ruff]
1517
# https://github.com/astral-sh/ruff#configuration

vinx_mjpeg_server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from aiohttp import web
77

88
from vinx_mjpeg_server.encoder import discover_encoders
9-
from vinx_mjpeg_server.http import HttpRequestHandler
9+
from vinx_mjpeg_server.server import HttpRequestHandler
1010

1111
logging.basicConfig(level=logging.DEBUG)
1212
logger = logging.getLogger("vinx_mjpeg_server")
@@ -23,8 +23,9 @@ async def main():
2323
parser.add_argument(
2424
"--fallback-image", help="A JPEG image to use as fallback when the encoder preview is unavailable"
2525
)
26-
parser.add_argument("-l", "--listen-address", default="0.0.0.0",
27-
help="The address the HTTP server should listen on")
26+
parser.add_argument(
27+
"-l", "--listen-address", default="0.0.0.0", help="The address the HTTP server should listen on"
28+
)
2829
parser.add_argument("-p", "--port", default=6180, type=int, help="The port the HTTP should listen on")
2930
args = parser.parse_args()
3031

0 commit comments

Comments
 (0)