generated from tomasanchez/cosmic-fastapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (31 loc) · 994 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM python:3.11.4-slim AS development_build
ARG APP_DIR=/app
ARG ENV
ENV ENV=${ENV} \
PYTHOPNUNBUFFERED=1 \
PYTHONHASHSEED=random \
PYTHONFAULTHANDLER=1 \
PIP_NO_CACHE_DIR=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.3.1 \
FASTAPI_MODEL_PATH=/app/models/topic_predictor_dev.joblib \
UVICORN_PORT=8000 \
UVICORN_HOST=0.0.0.0 \
UVICORN_RELOAD=0
# Deploy application
WORKDIR $APP_DIR
COPY pyproject.toml poetry.lock README.md ${APP_DIR}/
COPY db/training.csv ${APP_DIR}/db/
RUN mkdir -p ${APP_DIR}/models
ADD src ${APP_DIR}/src
# System dependencies
RUN apt-get update -y
RUN apt-get install -y antiword
RUN pip install --disable-pip-version-check "poetry==$POETRY_VERSION"
# Project initialization:
RUN poetry config virtualenvs.create false \
&& poetry install --only main \
&& poetry run spacy download es_core_news_lg
# train the model
RUN poetry run python -m heimdallr.train
CMD ["poetry", "run", "python","-m", "heimdallr.main"]