From 90a7b79c4e31e714f49531aac1c1aaef333b39cf Mon Sep 17 00:00:00 2001 From: Ukang'a Dickson Date: Mon, 6 May 2024 14:16:27 +0300 Subject: [PATCH] Docker: Split docs generation Minimises runtime installed dependencies --- .dockerignore | 1 + docker/onadata-uwsgi/Dockerfile.ubuntu | 16 +++- requirements/azure.pip | 12 +-- requirements/base.pip | 77 ++++++------------ requirements/dev.pip | 104 +++++++++---------------- requirements/docs.in | 1 + requirements/docs.pip | 48 ++++++++++++ requirements/s3.pip | 8 +- requirements/ses.pip | 8 +- setup.cfg | 4 +- 10 files changed, 135 insertions(+), 144 deletions(-) create mode 100644 requirements/docs.in create mode 100644 requirements/docs.pip diff --git a/.dockerignore b/.dockerignore index c5e8d87aeb..c3e4984f4e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -20,3 +20,4 @@ onadata/media onadata/test_data_media onadata/test_media +docs/_build diff --git a/docker/onadata-uwsgi/Dockerfile.ubuntu b/docker/onadata-uwsgi/Dockerfile.ubuntu index dcf2ebe0c1..5a1eae5df4 100644 --- a/docker/onadata-uwsgi/Dockerfile.ubuntu +++ b/docker/onadata-uwsgi/Dockerfile.ubuntu @@ -29,9 +29,12 @@ RUN apt-get update -q && \ automake # Generate and set en_US.UTF-8 locale -RUN locale-gen en_US.UTF-8 +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ + locale-gen en_US.UTF-8 ENV LC_ALL en_US.UTF-8 ENV LC_CTYPE en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en RUN dpkg-reconfigure locales @@ -101,19 +104,24 @@ RUN python -m pip install --no-cache-dir -U pip && \ python -m pip install --no-cache-dir -r requirements/ses.pip && \ python -m pip install --no-cache-dir -r requirements/azure.pip && \ python -m pip install --no-cache-dir setuptools==69.2.0 && \ - python -m pip install --no-cache-dir pyyaml==6.0.1 uwsgitop==0.12 + python -m pip install --no-cache-dir pyyaml==6.0.1 uwsgitop==0.12 supervisor==4.2.5 FROM base as docs + ENV PYENV_ROOT="$HOME/.pyenv" ENV PATH $PYENV_ROOT/versions/3.10.14/bin:$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH COPY --from=base /home/onadata/.pyenv/ /home/onadata/.pyenv/ COPY --from=base /srv/onadata/ /srv/onadata/ + USER root + RUN chown -R onadata:onadata /srv/onadata/ + USER onadata -# Compile API Docs -RUN make -C docs html +# install sphinx and build API docs. +RUN python -m pip install --no-cache-dir -r requirements/docs.pip && \ + make -C docs html FROM ubuntu:jammy-20240405 as runtime diff --git a/requirements/azure.pip b/requirements/azure.pip index eb6756a559..0b78e9199a 100644 --- a/requirements/azure.pip +++ b/requirements/azure.pip @@ -18,7 +18,7 @@ cffi==1.16.0 # via cryptography charset-normalizer==3.3.2 # via requests -cryptography==42.0.5 +cryptography==42.0.6 # via # -r requirements/azure.in # azure-storage-blob @@ -26,13 +26,13 @@ django==4.2.11 # via # -r requirements/azure.in # django-storages -django-storages==1.14.2 +django-storages==1.14.3 # via -r requirements/azure.in -idna==3.6 +idna==3.7 # via requests isodate==0.6.1 # via azure-storage-blob -pycparser==2.21 +pycparser==2.22 # via cffi requests==2.31.0 # via azure-core @@ -40,9 +40,9 @@ six==1.16.0 # via # azure-core # isodate -sqlparse==0.4.4 +sqlparse==0.5.0 # via django -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via # azure-core # azure-storage-blob diff --git a/requirements/base.pip b/requirements/base.pip index d3f695e47b..bfc9741ddf 100644 --- a/requirements/base.pip +++ b/requirements/base.pip @@ -6,8 +6,6 @@ # -e git+https://github.com/onaio/savreaderwriter.git@fix-pep-440-issues#egg=savreaderwriter # via -r requirements/base.in -alabaster==0.7.16 - # via sphinx amqp==5.2.0 # via kombu analytics-python==1.4.post1 @@ -23,15 +21,13 @@ attrs==23.2.0 # jsonlines # jsonschema # referencing -babel==2.14.0 - # via sphinx backoff==1.10.0 # via analytics-python billiard==4.2.0 # via celery -boto3==1.34.71 +boto3==1.34.98 # via dataflows-tabulator -botocore==1.34.71 +botocore==1.34.98 # via # boto3 # s3transfer @@ -39,7 +35,7 @@ cached-property==1.5.2 # via tableschema cachetools==5.3.3 # via google-auth -celery==5.3.6 +celery==5.4.0 # via onadata certifi==2024.2.2 # via @@ -68,7 +64,7 @@ click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery -cryptography==42.0.5 +cryptography==42.0.6 # via # jwcrypto # onadata @@ -159,7 +155,7 @@ djangorestframework-gis==1.0 # via onadata djangorestframework-guardian==0.3.0 # via onadata -djangorestframework-jsonapi==6.1.0 +djangorestframework-jsonapi==7.0.0 # via onadata djangorestframework-jsonp==1.0.2 # via onadata @@ -167,8 +163,6 @@ djangorestframework-xml==2.0.0 # via onadata dnspython==2.6.1 # via pymongo -docutils==0.19 - # via sphinx dpath==2.1.6 # via onadata elaphe3==0.2.0 @@ -193,29 +187,25 @@ hiredis==2.3.2 # via redis httplib2==0.22.0 # via onadata -idna==3.6 +idna==3.7 # via requests ijson==3.2.3 # via dataflows-tabulator -imagesize==1.4.1 - # via sphinx inflection==0.5.1 # via djangorestframework-jsonapi isodate==0.6.1 # via tableschema -jinja2==3.1.3 - # via sphinx jmespath==1.0.1 # via # boto3 # botocore jsonlines==4.0.0 # via dataflows-tabulator -jsonpickle==3.0.3 +jsonpickle==3.0.4 # via onadata jsonpointer==2.4 # via datapackage -jsonschema==4.21.1 +jsonschema==4.22.0 # via # datapackage # tableschema @@ -223,16 +213,14 @@ jsonschema-specifications==2023.12.1 # via jsonschema jwcrypto==1.5.6 # via django-oauth-toolkit -kombu==5.3.5 +kombu==5.3.7 # via celery linear-tsv==1.1.0 # via dataflows-tabulator -lxml==5.1.0 +lxml==5.2.1 # via onadata markdown==3.6 # via onadata -markupsafe==2.1.5 - # via jinja2 modilabs-python-utils==0.1.5 # via onadata monotonic==1.6 @@ -252,11 +240,9 @@ openpyxl==3.0.9 # dataflows-tabulator # onadata # pyxform -packaging==24.0 - # via sphinx -paho-mqtt==2.0.0 +paho-mqtt==2.1.0 # via onadata -pillow==10.2.0 +pillow==10.3.0 # via # elaphe3 # onadata @@ -270,19 +256,17 @@ pyasn1==0.6.0 # rsa pyasn1-modules==0.4.0 # via google-auth -pycparser==2.21 +pycparser==2.22 # via cffi pyfloip @ git+https://github.com/onaio/floip-py.git@3c980eb184069ae7c3c9136b18441978237cd41d # via -r requirements/base.in -pygments==2.17.2 - # via sphinx pyjwt==2.8.0 # via # ona-oidc # onadata pylibmc==1.6.3 # via onadata -pymongo==4.6.2 +pymongo==4.7.1 # via onadata pyparsing==3.1.2 # via httplib2 @@ -310,11 +294,11 @@ pyxform==1.12.2 # pyfloip recaptcha-client==1.0.6 # via onadata -redis==5.0.3 +redis==5.0.4 # via # django-redis # onadata -referencing==0.34.0 +referencing==0.35.1 # via # jsonschema # jsonschema-specifications @@ -328,7 +312,6 @@ requests==2.31.0 # onadata # python-json2xlsclient # requests-oauthlib - # sphinx # tableschema requests-oauthlib==2.0.0 # via google-auth-oauthlib @@ -342,7 +325,7 @@ rsa==4.9 # via google-auth s3transfer==0.10.1 # via boto3 -sentry-sdk==1.43.0 +sentry-sdk==1.45.0 # via onadata simplejson==3.19.2 # via onadata @@ -356,31 +339,15 @@ six==1.16.0 # linear-tsv # python-dateutil # tableschema -snowballstemmer==2.2.0 - # via sphinx -sphinx==6.2.1 - # via onadata -sphinxcontrib-applehelp==1.0.8 - # via sphinx -sphinxcontrib-devhelp==1.0.6 - # via sphinx -sphinxcontrib-htmlhelp==2.0.5 - # via sphinx -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.7 - # via sphinx -sphinxcontrib-serializinghtml==1.1.10 - # via sphinx -sqlalchemy==2.0.29 +sqlalchemy==2.0.30 # via dataflows-tabulator -sqlparse==0.4.4 +sqlparse==0.5.0 # via # django # django-debug-toolbar -tableschema==1.20.10 +tableschema==1.20.11 # via datapackage -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via # jwcrypto # sqlalchemy @@ -399,7 +366,7 @@ urllib3==2.2.1 # botocore # requests # sentry-sdk -uwsgi==2.0.24 +uwsgi==2.0.25.1 # via onadata vine==5.1.0 # via diff --git a/requirements/dev.pip b/requirements/dev.pip index 28137f7906..e944503f2f 100644 --- a/requirements/dev.pip +++ b/requirements/dev.pip @@ -6,8 +6,6 @@ # -e git+https://github.com/onaio/savreaderwriter.git@fix-pep-440-issues#egg=savreaderwriter # via -r requirements/base.in -alabaster==0.7.16 - # via sphinx amqp==5.2.0 # via kombu analytics-python==1.4.post1 @@ -31,15 +29,13 @@ attrs==23.2.0 # jsonlines # jsonschema # referencing -babel==2.14.0 - # via sphinx backoff==1.10.0 # via analytics-python billiard==4.2.0 # via celery -boto3==1.34.71 +boto3==1.34.98 # via dataflows-tabulator -botocore==1.34.71 +botocore==1.34.98 # via # boto3 # s3transfer @@ -47,7 +43,7 @@ cached-property==1.5.2 # via tableschema cachetools==5.3.3 # via google-auth -celery==5.3.6 +celery==5.4.0 # via onadata certifi==2024.2.2 # via @@ -78,7 +74,7 @@ click-plugins==1.1.1 # via celery click-repl==0.3.0 # via celery -cryptography==42.0.5 +cryptography==42.0.6 # via # jwcrypto # onadata @@ -180,7 +176,7 @@ djangorestframework-gis==1.0 # via onadata djangorestframework-guardian==0.3.0 # via onadata -djangorestframework-jsonapi==6.1.0 +djangorestframework-jsonapi==7.0.0 # via onadata djangorestframework-jsonp==1.0.2 # via onadata @@ -188,8 +184,6 @@ djangorestframework-xml==2.0.0 # via onadata dnspython==2.6.1 # via pymongo -docutils==0.19 - # via sphinx dodgy==0.2.1 # via prospector dpath==2.1.6 @@ -200,7 +194,7 @@ et-xmlfile==1.1.0 # via openpyxl executing==2.0.1 # via stack-data -filelock==3.13.3 +filelock==3.14.0 # via virtualenv flake8==5.0.4 # via @@ -218,7 +212,7 @@ geojson==3.1.0 # via onadata gitdb==4.0.11 # via gitpython -gitpython==3.1.42 +gitpython==3.1.43 # via prospector google-auth==2.29.0 # via @@ -234,21 +228,19 @@ httmock==1.4.0 # via -r requirements/dev.in httplib2==0.22.0 # via onadata -identify==2.5.35 +identify==2.5.36 # via pre-commit -idna==3.6 +idna==3.7 # via requests ijson==3.2.3 # via dataflows-tabulator -imagesize==1.4.1 - # via sphinx importlib-metadata==7.1.0 # via yapf inflection==0.5.1 # via djangorestframework-jsonapi ipdb==0.13.13 # via -r requirements/dev.in -ipython==8.22.2 +ipython==8.24.0 # via ipdb isodate==0.6.1 # via tableschema @@ -258,19 +250,17 @@ isort==5.13.2 # pylint jedi==0.19.1 # via ipython -jinja2==3.1.3 - # via sphinx jmespath==1.0.1 # via # boto3 # botocore jsonlines==4.0.0 # via dataflows-tabulator -jsonpickle==3.0.3 +jsonpickle==3.0.4 # via onadata jsonpointer==2.4 # via datapackage -jsonschema==4.21.1 +jsonschema==4.22.0 # via # datapackage # tableschema @@ -278,19 +268,17 @@ jsonschema-specifications==2023.12.1 # via jsonschema jwcrypto==1.5.6 # via django-oauth-toolkit -kombu==5.3.5 +kombu==5.3.7 # via celery lazy-object-proxy==1.10.0 # via astroid linear-tsv==1.1.0 # via dataflows-tabulator -lxml==5.1.0 +lxml==5.2.1 # via onadata markdown==3.6 # via onadata -markupsafe==2.1.5 - # via jinja2 -matplotlib-inline==0.1.6 +matplotlib-inline==0.1.7 # via ipython mccabe==0.7.0 # via @@ -322,20 +310,19 @@ packaging==24.0 # via # prospector # requirements-detector - # sphinx -paho-mqtt==2.0.0 +paho-mqtt==2.1.0 # via onadata -parso==0.8.3 +parso==0.8.4 # via jedi pep8-naming==0.10.0 # via prospector pexpect==4.9.0 # via ipython -pillow==10.2.0 +pillow==10.3.0 # via # elaphe3 # onadata -platformdirs==4.2.0 +platformdirs==4.2.1 # via # pylint # virtualenv @@ -364,7 +351,7 @@ pycodestyle==2.9.1 # via # flake8 # prospector -pycparser==2.21 +pycparser==2.22 # via cffi pydocstyle==6.3.0 # via prospector @@ -374,10 +361,8 @@ pyflakes==2.5.0 # prospector pyfloip @ git+https://github.com/onaio/floip-py.git@3c980eb184069ae7c3c9136b18441978237cd41d # via -r requirements/base.in -pygments==2.17.2 - # via - # ipython - # sphinx +pygments==2.18.0 + # via ipython pyjwt==2.8.0 # via # ona-oidc @@ -406,7 +391,7 @@ pylint-plugin-utils==0.7 # pylint-celery # pylint-django # pylint-flask -pymongo==4.6.2 +pymongo==4.7.1 # via onadata pyparsing==3.1.2 # via httplib2 @@ -438,11 +423,11 @@ pyyaml==6.0.1 # prospector recaptcha-client==1.0.6 # via onadata -redis==5.0.3 +redis==5.0.4 # via # django-redis # onadata -referencing==0.34.0 +referencing==0.35.1 # via # jsonschema # jsonschema-specifications @@ -458,9 +443,8 @@ requests==2.31.0 # python-json2xlsclient # requests-mock # requests-oauthlib - # sphinx # tableschema -requests-mock==1.11.0 +requests-mock==1.12.1 # via -r requirements/dev.in requests-oauthlib==2.0.0 # via google-auth-oauthlib @@ -478,7 +462,7 @@ s3transfer==0.10.1 # via boto3 semver==3.0.2 # via requirements-detector -sentry-sdk==1.43.0 +sentry-sdk==1.45.0 # via onadata setoptconf-tmp==0.3.1 # via prospector @@ -494,37 +478,20 @@ six==1.16.0 # isodate # linear-tsv # python-dateutil - # requests-mock # tableschema smmap==5.0.1 # via gitdb snowballstemmer==2.2.0 - # via - # pydocstyle - # sphinx -sphinx==6.2.1 - # via onadata -sphinxcontrib-applehelp==1.0.8 - # via sphinx -sphinxcontrib-devhelp==1.0.6 - # via sphinx -sphinxcontrib-htmlhelp==2.0.5 - # via sphinx -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.7 - # via sphinx -sphinxcontrib-serializinghtml==1.1.10 - # via sphinx -sqlalchemy==2.0.29 + # via pydocstyle +sqlalchemy==2.0.30 # via dataflows-tabulator -sqlparse==0.4.4 +sqlparse==0.5.0 # via # django # django-debug-toolbar stack-data==0.6.3 # via ipython -tableschema==1.20.10 +tableschema==1.20.11 # via datapackage tblib==3.0.0 # via -r requirements/dev.in @@ -536,12 +503,13 @@ tomli==2.0.1 # via yapf tomlkit==0.12.4 # via pylint -traitlets==5.14.2 +traitlets==5.14.3 # via # ipython # matplotlib-inline -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via + # ipython # jwcrypto # sqlalchemy tzdata==2024.1 @@ -559,14 +527,14 @@ urllib3==2.2.1 # botocore # requests # sentry-sdk -uwsgi==2.0.24 +uwsgi==2.0.25.1 # via onadata vine==5.1.0 # via # amqp # celery # kombu -virtualenv==20.25.1 +virtualenv==20.26.1 # via pre-commit wcwidth==0.2.13 # via prompt-toolkit diff --git a/requirements/docs.in b/requirements/docs.in new file mode 100644 index 0000000000..d0d294c97e --- /dev/null +++ b/requirements/docs.in @@ -0,0 +1 @@ +sphinx>=6.2,<7 diff --git a/requirements/docs.pip b/requirements/docs.pip new file mode 100644 index 0000000000..981a9f8d7c --- /dev/null +++ b/requirements/docs.pip @@ -0,0 +1,48 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --output-file=requirements/docs.pip --strip-extras requirements/docs.in +# +alabaster==0.7.16 + # via sphinx +babel==2.15.0 + # via sphinx +certifi==2024.2.2 + # via requests +charset-normalizer==3.3.2 + # via requests +docutils==0.19 + # via sphinx +idna==3.7 + # via requests +imagesize==1.4.1 + # via sphinx +jinja2==3.1.4 + # via sphinx +markupsafe==2.1.5 + # via jinja2 +packaging==24.0 + # via sphinx +pygments==2.18.0 + # via sphinx +requests==2.31.0 + # via sphinx +snowballstemmer==2.2.0 + # via sphinx +sphinx==6.2.1 + # via -r requirements/docs.in +sphinxcontrib-applehelp==1.0.8 + # via sphinx +sphinxcontrib-devhelp==1.0.6 + # via sphinx +sphinxcontrib-htmlhelp==2.0.5 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-qthelp==1.0.7 + # via sphinx +sphinxcontrib-serializinghtml==1.1.10 + # via sphinx +urllib3==2.2.1 + # via requests diff --git a/requirements/s3.pip b/requirements/s3.pip index fe691e6de3..60197bf2f6 100644 --- a/requirements/s3.pip +++ b/requirements/s3.pip @@ -6,9 +6,9 @@ # asgiref==3.8.1 # via django -boto3==1.34.71 +boto3==1.34.98 # via -r requirements/s3.in -botocore==1.34.71 +botocore==1.34.98 # via # boto3 # s3transfer @@ -16,7 +16,7 @@ django==4.2.11 # via # -r requirements/s3.in # django-storages -django-storages==1.14.2 +django-storages==1.14.3 # via -r requirements/s3.in jmespath==1.0.1 # via @@ -28,7 +28,7 @@ s3transfer==0.10.1 # via boto3 six==1.16.0 # via python-dateutil -sqlparse==0.4.4 +sqlparse==0.5.0 # via django urllib3==2.2.1 # via botocore diff --git a/requirements/ses.pip b/requirements/ses.pip index 1ca64618da..d3f3d8f86a 100644 --- a/requirements/ses.pip +++ b/requirements/ses.pip @@ -8,9 +8,9 @@ asgiref==3.8.1 # via django boto==2.49.0 # via -r requirements/ses.in -boto3==1.34.71 +boto3==1.34.98 # via django-ses -botocore==1.34.71 +botocore==1.34.98 # via # boto3 # s3transfer @@ -18,7 +18,7 @@ django==4.2.11 # via # -r requirements/ses.in # django-ses -django-ses==3.5.2 +django-ses==4.0.0 # via -r requirements/ses.in jmespath==1.0.1 # via @@ -32,7 +32,7 @@ s3transfer==0.10.1 # via boto3 six==1.16.0 # via python-dateutil -sqlparse==0.4.4 +sqlparse==0.5.0 # via django urllib3==2.2.1 # via botocore diff --git a/setup.cfg b/setup.cfg index edfc236e5f..0db2a0fa58 100644 --- a/setup.cfg +++ b/setup.cfg @@ -74,8 +74,6 @@ install_requires = python-memcached #XML Instance API utility xmltodict - #docs - sphinx>=6.2,<7 Markdown #others unicodecsv @@ -92,7 +90,7 @@ install_requires = simplejson uwsgi django-activity-stream - sentry-sdk + sentry-sdk>=1.43.0,<2 paho-mqtt cryptography>=39.0.1 #Monitoring