File size: 861 Bytes
775b8b4
a5fed35
 
775b8b4
 
 
 
a5fed35
03eec87
775b8b4
03eec87
a5fed35
03eec87
4a35568
03eec87
a5fed35
f42ec01
a5fed35
775b8b4
 
03eec87
 
775b8b4
 
 
 
 
 
 
4a35568
 
 
775b8b4
1114dde
 
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
FROM python:3.10-slim as base

WORKDIR /comma-fixer
ENV PYTHONUNBUFFERED=1

RUN python -m venv /venv
ENV PATH="/venv/bin:$PATH"

COPY setup.py .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade .

COPY commafixer/src/baseline.py commafixer/src/baseline.py
ENV TRANSFORMERS_CACHE=/coma-fixer/.cache
RUN python commafixer/src/baseline.py  # This pre-downloads models and tokenizers

COPY . .

FROM base as test

RUN pip install .[test]
RUN python -m pytest tests

FROM python:3.10-slim as deploy

WORKDIR /comma-fixer
COPY --from=base /comma-fixer /comma-fixer
COPY --from=base /venv /venv
ENV PATH="/venv/bin:$PATH"
# Copy pre-downloaded models and make sure we are using the env
ENV TRANSFORMERS_CACHE=/coma-fixer/.cache
COPY --from=base /coma-fixer/.cache /coma-fixer/.cache

EXPOSE 8000
CMD uvicorn "app:app" --port 8000 --host "0.0.0.0"