Update PyServer Containerfile
parent
6cd1ec9c97
commit
c004d9d3e7
|
|
@ -10,11 +10,9 @@
|
||||||
from .agent import Agent
|
from .agent import Agent
|
||||||
from .chaos import AgentOfChaos
|
from .chaos import AgentOfChaos
|
||||||
from .mute import MuteAgent
|
from .mute import MuteAgent
|
||||||
from .remote import RemoteAgent
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Agent",
|
"Agent",
|
||||||
"AgentOfChaos",
|
"AgentOfChaos",
|
||||||
"MuteAgent",
|
"MuteAgent",
|
||||||
"RemoteAgent",
|
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ RUN pip install --no-cache-dir --no-index --find-links=/wheels \
|
||||||
-r requirements-pyserver.txt && rm -rf /wheels
|
-r requirements-pyserver.txt && rm -rf /wheels
|
||||||
|
|
||||||
# Install PyServer code
|
# Install PyServer code
|
||||||
|
COPY agents/ agents/
|
||||||
COPY pyserver/ pyserver/
|
COPY pyserver/ pyserver/
|
||||||
COPY server.py .
|
COPY server.py .
|
||||||
|
|
||||||
|
ENV CONTAINERIZED=1
|
||||||
|
|
||||||
CMD ["python", "server.py"]
|
CMD ["python", "server.py"]
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from flask import Flask, jsonify, request
|
from flask import Flask, jsonify, request
|
||||||
from agents import Agent
|
from agents import Agent
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
@ -24,6 +26,7 @@ class PyServer:
|
||||||
:param import_name: Flask application import name
|
:param import_name: Flask application import name
|
||||||
:type import_name: str
|
:type import_name: str
|
||||||
"""
|
"""
|
||||||
|
self.containerized : bool = bool(int(os.environ.get("CONTAINERIZED", "0")))
|
||||||
self.agent = agent
|
self.agent = agent
|
||||||
self.app = Flask(import_name)
|
self.app = Flask(import_name)
|
||||||
|
|
||||||
|
|
@ -49,6 +52,7 @@ class PyServer:
|
||||||
|
|
||||||
d = { **self.agent.profile, **d }
|
d = { **self.agent.profile, **d }
|
||||||
|
|
||||||
|
d["me.noordstar.peanuts.containerized"] = self.containerized
|
||||||
d["games"] = {}
|
d["games"] = {}
|
||||||
for game, (profile, _) in self.agent.registered_games.items():
|
for game, (profile, _) in self.agent.registered_games.items():
|
||||||
d["games"][game] = profile
|
d["games"][game] = profile
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue