diff --git a/.gitignore b/.gitignore index 9dcae54..8e67ca7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .venv/ .idea/ -__pychache__/ +__pychache__/* diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..b80451b --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: "3.5" + +services: + rps: + build: ./rps + stdin_open: true + tty: true + environment: + DB_PASS: ${DB_PASS} + volumes: + - ./rps:/rps diff --git a/rps/__init__.py b/rps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rps/__main__.py b/rps/__main__.py new file mode 100644 index 0000000..361d727 --- /dev/null +++ b/rps/__main__.py @@ -0,0 +1,21 @@ +import uvloop +import asyncio +import logging + + +def main() -> None: + asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) + asyncio.run(async_main()) + logging.info("Created async loop") + + +async def async_main() -> None: + loop = asyncio.get_event_loop() + + +if __name__ == '__main__': + format='[%(levelname)s][%(name)s] %(message)s' + logging.basicConfig(level=logging.INFO, format=format) + + logging.info("Started program") + main() diff --git a/rps/dockerfile b/rps/dockerfile new file mode 100644 index 0000000..fdc8e4e --- /dev/null +++ b/rps/dockerfile @@ -0,0 +1,23 @@ +FROM python:3.8-slim-buster + +WORKDIR /app +COPY . /app + +RUN apt update && apt install -y \ + libavdevice-dev \ + libavfilter-dev \ + libopus-dev \ + libvpx-dev \ + pkg-config \ + && \ + rm -rf /var/lib/apt/lists/* \ + +RUN pip install --upgrade \ + pip \ + poetry \ + +RUN poetry update \ + && \ + poetry install \ + +CMD python -m backend