-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
27 lines (19 loc) · 847 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
# Builder stage: install dependencies and download resources
FROM python:3.8-slim-buster AS builder
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN apt-get update && \
apt-get install --no-install-recommends --yes build-essential wget && \
pip install --no-cache-dir -r requirements.txt && \
wget https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.ftz -O lid.176.ftz && \
rm -rf /var/lib/apt/lists/*
# Final stage: copy only what is needed
FROM python:3.8-slim-buster
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
COPY --from=builder /app/lid.176.ftz /app/lid.176.ftz
COPY --from=builder /app/requirements.txt /app/requirements.txt
COPY ./app/*.py /app
RUN python -m nltk.downloader punkt_tab
EXPOSE 8000
CMD ["python", "app.py"]