Skip to content

Commit 306e2be

Browse files
committed
Add Dockerfile
1 parent ed61873 commit 306e2be

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

server/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: 2026 Carnegie Mellon University - Satyalab
2+
#
3+
# SPDX-License-Identifier: GPL-2.0-only
4+
5+
FROM python:3.10-slim
6+
7+
LABEL org.opencontainers.image.vendor="CMU Satyalab" \
8+
org.opencontainers.image.authors=satya-group@lists.andrew.cmu.edu
9+
10+
ARG DEBIAN_FRONTEND=noninteractive
11+
12+
# Install build and runtime dependencies
13+
RUN apt-get update && apt-get install -y \
14+
python3 \
15+
python3-pip
16+
17+
RUN pip3 install --upgrade pip
18+
19+
COPY requirements.txt ./requirements.txt
20+
RUN python3 -m pip install -r requirements.txt
21+
COPY main.py main.py
22+
23+
EXPOSE 5555 9099 8000
24+
25+
ENTRYPOINT ["python3", "main.py"]

server/main.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright (C) 2026 Carnegie Mellon University
4+
# SPDX-FileCopyrightText: 2023 Carnegie Mellon University - Satyalab
5+
#
6+
# SPDX-License-Identifier: GPL-2.0-only
7+
8+
"""Entrypoint for Gabriel Docker image."""
9+
10+
import argparse
11+
import logging
12+
13+
from gabriel_server.network_engine.server_runner import ServerRunner
14+
15+
DEFAULT_NUM_TOKENS = 2
16+
INPUT_QUEUE_MAXSIZE = 60
17+
18+
logging.basicConfig(
19+
level=logging.DEBUG,
20+
format="%(asctime)s - %(filename)s:%(lineno)d - %(levelname)s - "
21+
"%(message)s",
22+
datefmt="%Y-%m-%d %H:%M:%S",
23+
)
24+
25+
logger = logging.getLogger(__name__)
26+
27+
28+
def main():
29+
"""Main method for Gabriel Docker image."""
30+
parser = argparse.ArgumentParser(
31+
formatter_class=argparse.ArgumentDefaultsHelpFormatter
32+
)
33+
parser.add_argument(
34+
"-t",
35+
"--tokens",
36+
type=int,
37+
default=DEFAULT_NUM_TOKENS,
38+
help="number of tokens",
39+
)
40+
41+
parser.add_argument("-p", "--port", type=int, help="Set port number")
42+
43+
parser.add_argument("--path", type=str, help="Set ipc path")
44+
45+
parser.add_argument(
46+
"-q--queue",
47+
type=int,
48+
default=INPUT_QUEUE_MAXSIZE,
49+
help="Max input queue size",
50+
)
51+
52+
parser.add_argument(
53+
"-w",
54+
"--websockets",
55+
action="store_true",
56+
help="Use Websockets Gabriel client",
57+
)
58+
59+
args, _ = parser.parse_known_args()
60+
61+
print(args.port)
62+
if args.port and args.path:
63+
raise ValueError("Can't specify both port and path")
64+
65+
use_ipc = False
66+
if args.path:
67+
use_ipc = True
68+
69+
client_endpoint = args.port if not args.path else args.path
70+
71+
server_runner = ServerRunner(
72+
client_endpoint=client_endpoint,
73+
engine_zmq_endpoint="tcp://*:5555",
74+
num_tokens=args.tokens,
75+
input_queue_maxsize=INPUT_QUEUE_MAXSIZE, # TODO: Don't hardcode this
76+
use_zeromq=not args.websockets,
77+
use_ipc=use_ipc,
78+
)
79+
server_runner.run()
80+
81+
82+
if __name__ == "__main__":
83+
main()

server/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gabriel-server

0 commit comments

Comments
 (0)