Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Dockerfile 1.8 KB

You have to be logged in to leave a comment. Sign In
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  1. FROM python:3.8.6-slim-buster as base
  2. ENV PYTHONFAULTHANDLER=1 \
  3. PYTHONUNBUFFERED=1 \
  4. PYTHONHASHSEED=random \
  5. PYTHONDONTWRITEBYTECODE=1 \
  6. # pip:
  7. PIP_NO_CACHE_DIR=off \
  8. PIP_DISABLE_PIP_VERSION_CHECK=on \
  9. PIP_DEFAULT_TIMEOUT=100 \
  10. # tini
  11. TINI_VERSION=v0.19.0 \
  12. # poetry
  13. POETRY_NO_INTERACTION=1 \
  14. POETRY_VIRTUALENVS_CREATE=false \
  15. POETRY_CACHE_DIR='/var/cache/pypoetry' \
  16. PATH="$PATH:/root/.poetry/bin"
  17. WORKDIR "/app"
  18. RUN apt-get update && apt-get install --no-install-recommends -y wget curl bash build-essential git \
  19. && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" \
  20. && chmod +x /usr/local/bin/tini && tini --version \
  21. && curl -sSL 'https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py' | python \
  22. && poetry --version \
  23. && apt-get remove -y wget && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
  24. && apt-get clean -y && rm -rf /var/lib/apt/lists/* \
  25. && groupadd -r web && useradd -d /app -r -g web web \
  26. && chown web:web -R /app
  27. # ---- Stage 2: Install Requirements --------------------------------------------
  28. FROM base as reqinstall
  29. COPY --chown=web:web ./poetry.lock ./pyproject.toml /app/
  30. RUN poetry install --no-ansi --no-interaction && rm -rf "$POETRY_CACHE_DIR"
  31. # ---- Stage 3: Install Application and get models ------------------------------
  32. FROM reqinstall
  33. ENV PORT=8080
  34. ENV NWORKERS=2
  35. ENV NTHREADS=8
  36. ENV WORKER=uvicorn.workers.UvicornWorker
  37. COPY --chown=web . /app/
  38. # To install news_cat
  39. RUN poetry install --no-ansi --no-interaction && rm -rf "$POETRY_CACHE_DIR" \
  40. && dvc pull && ls artifacts \
  41. && rm -rf .dvc && rm -rf .git
  42. EXPOSE $PORT
  43. USER web
  44. ENTRYPOINT ["tini", "-g", "--"]
  45. CMD gunicorn -b :${PORT} --threads ${NTHREADS} -w ${NWORKERS} -k ${WORKER} app:app
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...