From e6c29a08b7fbbbd4533d635a51e71a8060ab9d48 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 3 Jun 2023 16:15:06 +0800 Subject: Dockerize --- Dockerfile | 11 +++++++++++ web.py | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e520c79 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.10 + +WORKDIR /app + +COPY requirements.txt . + +RUN pip3 install --no-cache-dir -r requirements.txt + +COPY *.py . + +CMD ["python3", "web.py"] \ No newline at end of file diff --git a/web.py b/web.py index 0d2a39f..395a186 100644 --- a/web.py +++ b/web.py @@ -1,3 +1,4 @@ +import argparse import asyncio import os import re @@ -51,11 +52,15 @@ def setup_loop(): if __name__ == '__main__': + p = argparse.ArgumentParser(prog='utaten2tex') + p.add_argument('-l', '--host', default='127.0.0.1') + p.add_argument('-p', '--port', default='8080') + args = p.parse_args() setup_loop() uvicorn.run( 'web:app', - host='127.0.0.1', - port=8000, + host=args.host, + port=int(args.port), log_level='info', loop='none', # use custom loop initializer ) -- cgit v1.2.3