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 2.5 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
  1. ARG BASE_IMAGE=ubuntu:20.04
  2. FROM ${BASE_IMAGE}
  3. ARG PROJECT_NAME=slide_generation
  4. ARG USER_NAME=botany
  5. ARG GROUP_NAME=challengers
  6. ARG UID=1000
  7. ARG GID=1000
  8. ARG PYTHON_VERSION=3.8
  9. ARG APPLICATION_DIRECTORY=/home/${USER_NAME}/${PROJECT_NAME}
  10. ARG RUN_POETRY_INSTALL_AT_BUILD_TIME="false"
  11. ENV DEBIAN_FRONTEND="noninteractive" \
  12. LC_ALL="C.UTF-8" \
  13. LANG="C.UTF-8" \
  14. PYTHONPATH=${APPLICATION_DIRECTORY}
  15. # Following is needed to install python 3.7
  16. RUN apt update && apt install --no-install-recommends -y software-properties-common
  17. RUN add-apt-repository ppa:deadsnakes/ppa
  18. RUN apt update && apt install --no-install-recommends -y \
  19. git curl make ssh openssh-client \
  20. python${PYTHON_VERSION} python3-pip python-is-python3
  21. # Following is needed to use opencv inside the container
  22. RUN DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
  23. ffmpeg \
  24. libsm6 \
  25. libxext6 \
  26. libmagickwand-dev \
  27. ghostscript
  28. RUN sed -i -e "s/rights=\"none\" pattern=\"PDF\"/rights=\"read|write\" pattern=\"PDF\"/g" /etc/ImageMagick-6/policy.xml
  29. # Following is needed to swtich default python3 version
  30. # For detail, please check following link https://unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu
  31. RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
  32. && update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
  33. # `requests` needs to be upgraded to avoid RequestsDependencyWarning
  34. # ref: https://stackoverflow.com/questions/56155627/requestsdependencywarning-urllib3-1-25-2-or-chardet-3-0-4-doesnt-match-a-s
  35. && python3 -m pip install --upgrade pip setuptools requests \
  36. && python3 -m pip install poetry
  37. # Add user. Without this, following process is executed as admin.
  38. RUN groupadd -g ${GID} ${GROUP_NAME} \
  39. && useradd -ms /bin/sh -u ${UID} -g ${GID} ${USER_NAME}
  40. USER ${USER_NAME}
  41. WORKDIR ${APPLICATION_DIRECTORY}
  42. # If ${RUN_POETRY_INSTALL_AT_BUILD_TIME} = "true", install Python package by Poetry and move .venv under ${HOME}.
  43. # This process is for CI (GitHub Actions). To prevent overwrite by volume of docker compose, .venv is moved under ${HOME}.
  44. COPY --chown=${UID}:${GID} pyproject.toml poetry.lock poetry.toml .
  45. RUN test ${RUN_POETRY_INSTALL_AT_BUILD_TIME} = "true" && poetry install || echo "skip to run poetry install."
  46. RUN test ${RUN_POETRY_INSTALL_AT_BUILD_TIME} = "true" && mv ${APPLICATION_DIRECTORY}/.venv ${HOME}/.venv || echo "skip to move .venv."
Tip!

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

Comments

Loading...