Docker config
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Hello world!"
|
||||
echo "Starting FairHopper game server"
|
||||
|
||||
echo "Press [CTRL+C] to stop.."
|
||||
while :
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
uvicorn \
|
||||
main:app \
|
||||
--host 0.0.0.0 \
|
||||
--port ${FAIRHOPPER_API_PORT} \
|
||||
--workers=1
|
||||
|
||||
40
.docker/settings.py
Normal file
40
.docker/settings.py
Normal file
@ -0,0 +1,40 @@
|
||||
import os
|
||||
import logging
|
||||
|
||||
from hopper.models.config import (
|
||||
BoardSettings,
|
||||
DebugSettings,
|
||||
GameSettings,
|
||||
InactivityWatchdogSettings,
|
||||
Settings,
|
||||
WSServerSettings,
|
||||
)
|
||||
from hopper.models.product import Product
|
||||
|
||||
settings = Settings(
|
||||
game=GameSettings(),
|
||||
board=BoardSettings(
|
||||
WIDTH=20,
|
||||
HEIGHT=20,
|
||||
OBSTACLE_COUNT=0,
|
||||
),
|
||||
inacivity_watchdog=InactivityWatchdogSettings(),
|
||||
purchase_timeout=5,
|
||||
log_level=logging.INFO,
|
||||
products=[
|
||||
Product(name="CocaCola", id="cocacola-id"),
|
||||
Product(name="Pepsi", id="pepsi-id"),
|
||||
Product(name="Fanta", id="fanta-id"),
|
||||
Product(name="Snickers", id="snickers-id"),
|
||||
Product(name="Mars", id="mars-id"),
|
||||
Product(name="Burek", id="burek-id"),
|
||||
],
|
||||
ws_server=WSServerSettings(
|
||||
HOST="0.0.0.0",
|
||||
PORT=int(os.environ.get("FAIRHOPPER_WS_PORT", 8011)),
|
||||
),
|
||||
debug=DebugSettings(
|
||||
PRINT_BOARD=True,
|
||||
PLAYERS=[],
|
||||
),
|
||||
)
|
||||
@ -18,6 +18,8 @@ RUN python -m venv /venv
|
||||
ENV \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
FAIRHOPPER_API_PORT=${INTERNAL_API_PORT} \
|
||||
FAIRHOPPER_WS_PORT=${INTERNAL_WS_PORT} \
|
||||
PATH="/venv/bin:$PATH"
|
||||
|
||||
RUN \
|
||||
@ -26,7 +28,8 @@ RUN \
|
||||
# install python libs
|
||||
pip install -r requirements.txt --no-cache-dir --prefer-binary
|
||||
|
||||
COPY ./.docker/run.sh .
|
||||
COPY ./hopper ./service
|
||||
COPY ./.docker/* ./
|
||||
COPY ./hopper ./hopper
|
||||
COPY ./main.py .
|
||||
|
||||
ENTRYPOINT [ "/app/run.sh" ]
|
||||
|
||||
@ -29,7 +29,7 @@ class InactivityWatchdogSettings:
|
||||
|
||||
@dataclass
|
||||
class WSServerSettings:
|
||||
HOST: str = "localhost"
|
||||
HOST: str = "127.0.0.1"
|
||||
PORT: int = 8011
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class Settings:
|
||||
board: BoardSettings
|
||||
inacivity_watchdog: InactivityWatchdogSettings
|
||||
ws_server: WSServerSettings
|
||||
purchase_timeout: int = 10 # seconds
|
||||
purchase_timeout: int = 10 # seconds
|
||||
log_level: int = logging.INFO
|
||||
products: List[Product] = None
|
||||
debug: Optional[DebugSettings] = None
|
||||
|
||||
Reference in New Issue
Block a user