-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
23 lines (16 loc) · 963 Bytes
/
Copy pathDockerfile
File metadata and controls
23 lines (16 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends libgl1 libglib2.0-0 && \
rm -rf /var/lib/apt/lists/*
COPY pyproject.toml .
RUN pip install --no-cache-dir \
fastapi uvicorn python-multipart \
easyocr pillow \
torch torchvision --index-url https://download.pytorch.org/whl/cpu
COPY src/ ./src/
ENV PYTHONPATH=/app/src
ENV HOST=0.0.0.0
ENV PORT=8017
EXPOSE 8017
CMD ["python", "-c", "\nimport logging, uvicorn, warnings, os\nwarnings.filterwarnings('ignore')\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\nfrom main import app\nfrom config import HOST, PORT, DEVICE\nlogging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s')\nfor n in ['uvicorn.error', 'uvicorn.access']:\n logging.getLogger(n).setLevel(logging.CRITICAL)\nlogging.info(f'Device: {DEVICE} | Server: {HOST}:{PORT}')\nuvicorn.run(app, host=HOST, port=PORT, timeout_keep_alive=300, log_level='error')\n"]