add init code

This commit is contained in:
Artur Tamborski 2019-10-20 18:44:16 +02:00
parent 925152c19c
commit 7d6a8c67f3
5 changed files with 56 additions and 1 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
.venv/ .venv/
.idea/ .idea/
__pychache__/ __pychache__/*

11
docker-compose.yaml Normal file
View File

@ -0,0 +1,11 @@
version: "3.5"
services:
rps:
build: ./rps
stdin_open: true
tty: true
environment:
DB_PASS: ${DB_PASS}
volumes:
- ./rps:/rps

0
rps/__init__.py Normal file
View File

21
rps/__main__.py Normal file
View File

@ -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()

23
rps/dockerfile Normal file
View File

@ -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