diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d8fcb1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM tryton/tryton: +LABEL org.label-schema.version="" +ENV TRYTOND_VERSION="" +ENV PYTHON_VERSION="" +ENV GITEA_ORG="" +ENV GITEA_DOMAIN="" +ENV GITEA_USER="" +ENV GITEA_PASSWORD="" +ENV GITEA_ACCESS_TOKEN="" +ENV GnuHealth="False" +ENV Etrivial="False" +ENV Trytonar="False" +ENV OneCluster="False" +ENV Presik="False" +ENV Datalife="False" +ENV NaNtic="False" +ENV Kalenis="False" +ENV DIR_MODULES=/usr/local/lib/$PYTHON_VERSION/dist-packages/trytond/modules +USER root + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + git \ + python3-click + +RUN echo "Install modules non official" +COPY trytond-modules_non_official.sh /tmp/trytond-modules_non_official.sh +RUN cd /tmp/ \ + && bash trytond-modules_non_official.sh +USER trytond diff --git a/trytond-modules_non_official.sh b/trytond-modules_non_official.sh new file mode 100644 index 0000000..561df9a --- /dev/null +++ b/trytond-modules_non_official.sh @@ -0,0 +1,451 @@ +#!/usr/bin/bash +gitea_url="https://${GITEA_USER}:${GITEA_PASSWORD}@${GITEA_DOMAIN}/" + +cd /tmp +git clone "${gitea_url}${GITEA_ORG}/oc-multi_migrate_to_gitea.git" +multi_migrate="/tmp/oc-multi_migrate_to_gitea/migrate_to_gitea.py" +cd $DIR_MODULES + +clone_module() { + cd $DIR_MODULES + local org=$1 + local branch=$2 + local prefix=$3 + shift + local Array=("${@}") + url=${gitea_url}${org}"/" + for module in "${Array[@]}"; do + if [ ${prefix} = 'False' ]; then + if [ ${branch} != "False" ]; then + if [ -d $module ]; then + echo "Module $module already exists" + else + git clone -b ${branch} $url$module + fi + fi + elif [ `echo $module | awk /${prefix}/` ]; then + name=`echo $modules$module | cut --complement -f 1 -d '-'` + if [ ${branch} != "False" ]; then + if [ -d $module ]; then + echo "Module $module already exists" + else + git clone -b ${branch} $url$module + mv $module $name + fi + else + git clone $url$module + cd $module + ${PYTHON_VERSION} setup.py install + cd .. + fi + fi + done +} + +inactive_module() { + cd $DIR_MODULES + local prefix=$1 + local pip=$2 + shift + local Array=("${@}") + for module in "${Array[@]}"; do + if [ $pip = "True" ]; then + pip uninstall -y $prefix$module + else + rm -rf $module + fi + done +} + + +if [ ${OneCluster} = "True" ]; then + apt-get update \ + && apt-get install -y --no-install-recommends \ + git \ + fossil \ + pkg-config \ + libxml2-dev \ + libxmlsec1-dev \ + libxmlsec1-openssl \ + libffi-dev \ + build-essential \ + python3-dev \ + python3-qrcode \ + && rm -rf /var/lib/apt/lists/* \ + && pip3 install --upgrade pip \ + && pip3 install pytz \ + "git+https://github.com/bit4bit/facho.git" + prefix="trytondo-" + team_org="OneCluster" + pip="False" + get_one_cluster=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $team_org --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) + clone_module $team_org ${TRYTOND_VERSION} $prefix "${get_one_cluster[@]}" + + modules_presik=( + trytonpsk-account_co_pyme ) + clone_module "Presik" "False" "trytonpsk-" "${modules_presik[@]}" + modules_nantic=( + trytond-sale_w_tax + trytond-sale_pos + trytond-sale_shop + trytond-sale_payment + trytond-purchase_discount + trytond-account_invoice_discount ) + clone_module "NaNtic" ${TRYTOND_VERSION} "trytond-" "${modules_nantic[@]}" +fi + + +if [ ${Presik} = "True" ]; then + prefix="trytonpsk-" + team_org="Presik" + pip="True" + pip3 install --upgrade pip \ + && pip3 install Jinja2 \ + sendgrid \ + qrcode \ + xmltodict + + get_presik=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org ${team_org} --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) + clone_module $team_org "False" $prefix "${get_presik[@]}" + inactive_modules_presik=( + sale_pos_frontend + sale_pos_frontend_rest + sale_pos_commission + health_history + health_nursing + health_inpatient + health_emergency + smtp + ) + inactive_module $prefix $pip "${inactive_modules_presik[@]}" + + modules_nantic=(trytond-smtp) + clone_module "NaNtic" ${TRYTOND_VERSION} "trytond-" "${modules_nantic[@]}" +fi + + +if [ ${Datalife} = "True" ]; then + prefix="trytond-" + team_org="Datalife" + pip="False" + apt-get install -y --no-install-recommends \ + build-essential \ + python3-dev \ + libffi-dev \ + && pip3 uninstall -y trytond-incoterm \ + && cd /usr/local \ + && git clone -b main https://${GITEA_USER}:${GITEA_PASSWORD}@gitea.onecluster.org/NaNtic/python-edifact.git \ + && cd python-edifact \ + && ${PYTHON_VERSION} setup.py install \ + && cd $DIR_MODULES \ + && rm -rf incoterm \ + && pip3 install --upgrade pip \ + && pip3 install Jinja2 \ + babel \ + barcodenumber \ + unidecode \ + oyaml \ + retrofix \ + cryptography + + get_datalife=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $team_org --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) + clone_module $team_org ${TRYTOND_VERSION} $prefix "${get_datalife[@]}" + inactive_modules_datalife=( + edw_mssql + stock_shipment_in_edi + ) + inactive_module $prefix $pip "${inactive_modules_datalife[@]}" + + modules_nantic=( + trytond-account_payment_type + trytond-company_bank + trytond-party_edi + trytond-account_invoice_company_currency + trytond-stock_shipment_in_edi + trytond-jasper_reports + trytond-stock_scanner + trytond-stock_valued + trytond-stock_kit + trytond-sale_kit + trytond-account_payment_type + trytond-account_invoice_edi + trytond-edocument_unedifact + trytond-account_move_draft + trytond-account_payment_receipt + trytond-product_barcode ) + clone_module "NaNtic" ${TRYTOND_VERSION} $prefix "${modules_nantic[@]}" +fi + + +if [ ${NaNtic} = "True" ]; then + prefix="trytond-" + team_org="NaNtic" + pip="False" + apt-get install -y --no-install-recommends \ + build-essential \ + python3-dev \ + libffi-dev \ + libldap2-dev \ + libsasl2-dev \ + libcups2-dev \ + && pip3 install --upgrade pip \ + && pip3 install "cryptography>=2.1.4" \ + "pyopenssl>=17.5.0" \ + bcrypt \ + blinker \ + "Genshi>=0.6" \ + "Jinja2>=2.6" \ + "Pygments>=1.6" \ + "Sphinx>=1.1.3" \ + "argparse>=1.2.1" \ + "caldav>=0.1.12" \ + "chardet>=2.1.1" \ + "coverage>=3.6" \ + "docutils>=0.10" \ + "easyimap>=0.3.3" \ + "jsonrpclib" \ + "lxml>=3.1.0" \ + "nose>=1.2.1" \ + passwordmeter \ + petl \ + "polib>=1.0.2" \ + "psycopg2-binary>=2.4.6" \ + pydot \ + python-magic \ + "pyparsing>=1.5.6" \ + PySimpleSOAP \ + "python-dateutil>=2.1" \ + "python-ldap>=2.4.10" \ + ldap3 \ + python-nmap \ + "python-sql>=0.8" \ + "python-stdnum>=0.9" \ + banknumber \ + "pytz>=2012h" \ + "pyusb>=1.0.0b1" \ + "pyserial>=2.7" \ + "relatorio>=0.7.0" \ + "simplejson>=2.6.2" \ + six \ + "vobject>=0.8.1c" \ + "yolk>=0.4.3" \ + "openpyxl>=2.1.1" \ + "git+https://github.com/NaN-tic/python-pharma_datamatrix#egg=pharma_datamatrix" \ + vatnumber \ + mock \ + html2text \ + goocalendar \ + emailvalid \ + simpleeval \ + pyflakes \ + PyPDF2 \ + cached-property \ + wrapt \ + passlib \ + langid \ + babel \ + "weasyprint<53" \ + pycparser \ + "pycha>=0.4.0" \ + pyyaml \ + ipaddress \ + Unidecode \ + "xlrd==1.2.0" \ + pq \ + humanize \ + urllib3 \ + "pymssql<3.0" \ + "retrofix>=0.23" \ + zeep \ + xmlsig \ + pillow \ + slug \ + decorator \ + flask_login \ + whoosh \ + geopy \ + pycups \ + iso8601 \ + oyaml \ + "git+https://github.com/NaN-tic/python-edifact#egg=edifact" \ + unicodecsv \ + requests \ + formulas \ + pycountry \ + forex_python \ + ShopifyAPI \ + mrw \ + freezegun \ + qrcode \ + python-barcode \ + "Flask==1.1.4" \ + "Flask-Babel>=0.8" \ + "Flask-WTF>=0.8.3" \ + "flask_tryton>=0.5" \ + "Flask-paginate" \ + "Flask-Mail" \ + "Flask-Cache" \ + "flask-lesscss" \ + "py-wikimarkup" \ + "emailvalid" \ + "htmlmin" \ + "redsys" \ + "pycrypto" \ + "email_validator" \ + "flask_session" \ + "charset-normalizer" \ + "Werkzeug==1.0.1" \ + barcodenumber + get_nantic=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $team_org --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) + clone_module $team_org ${TRYTOND_VERSION} $prefix "${get_nantic[@]}" + inactive_modules_nantic=(patches) + inactive_module $prefix $pip "${inactive_modules_nantic[@]}" +fi + + +if [ ${Kalenis} = "True" ]; then + team_org="kalenis" + branch="master" + apt-get install -y --no-install-recommends \ + build-essential \ + python3-dev \ + wget \ + && pip3 install --upgrade pip \ + && pip install numpy \ + Cython \ + pandas \ + matplotlib \ + xlrd \ + xlutils \ + formulas \ + unidecode \ + openpyxl==2.6.4 \ + Jinja2 \ + WeasyPrint \ + PyPDF2 \ + pytz \ + babel \ + && git clone -b ${branch} ${gitea_url}Kalenis/kalenislims.git \ + && mv kalenislims/lims* ${DIR_MODULES} \ + && rm -rf kalenislims \ + && git clone -b ${branch} ${gitea_url}Kalenis/kalenis_user_view.git \ + && mv kalenis_user_view ${DIR_MODULES}/user_view \ + && wget https://downloads.kalenislims.com/frontend_dist_${TRYTOND_VERSION}.tar.gz \ + && tar -xzf frontend_dist_${TRYTOND_VERSION}.tar.gz \ + && rm -rf /var/lib/trytond/www \ + && mv frontend_dist_${TRYTOND_VERSION} /var/lib/trytond/www +fi + + +if [ ${GnuHealth} = "True" ]; then + apt-get install -y --no-install-recommends \ + build-essential \ + python3-dev \ + wget \ + libldap2-dev \ + libsasl2-dev \ + ldap-utils \ + tox \ + lcov \ + valgrind \ + && pip3 install --upgrade pip \ + && pip3 install lxml \ + wrapt \ + python-dateutil \ + psycopg2-binary \ + pytz \ + python-ldap \ + qrcode \ + python-barcode \ + six \ + Pillow \ + caldav \ + polib \ + python-sql \ + python-stdnum \ + simpleeval \ + configparser \ + pywebdav3-gnuhealth \ + bcrypt \ + numpy \ + unoconv \ + python-magic \ + passlib \ + beren \ + pendulum \ + matplotlib \ + "werkzeug<1.0" \ + vobject==0.9.5 \ + && cd /tmp \ + && wget https://ftp.gnu.org/gnu/health/gnuhealth-latest.tar.gz \ + && tar -xzf gnuhealth-latest.tar.gz \ + && mv gnuhealth-3.8.0/health* ${DIR_MODULES} \ + && rm -rf gnuhealth-3.8.0 \ + && mv ${DIR_MODULES}/health_webdav3_server ${DIR_MODULES}/webdav \ + && mv ${DIR_MODULES}/health_caldav ${DIR_MODULES}/calendar +fi + + +if [ ${Trytonar} = "True" ]; then + prefix="False" + team_org="tryton-ar" + pip="False" + apt-get install -y --no-install-recommends \ + wget \ + unzip \ + build-essential \ + python3-dev \ + libxslt-dev \ + libffi-dev \ + libssl-dev \ + swig \ + unzip \ + && cd /opt \ + && git clone https://github.com/reingart/pyafipws.git \ + && cd pyafipws \ + && pip3 install --upgrade pip \ + && pip3 install httplib2==0.9.2 \ + fpdf>=1.7.2 \ + dbf>=0.88.019 \ + Pillow>=2.0.0 \ + tabulate==0.8.5 \ + certifi>=2020.4.5.1 \ + qrcode==6.1 \ + future==0.18.2 \ + unicode \ + unidecode \ + && ${PYTHON_VERSION} setup.py install + + get_trytonar=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $team_org --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) + clone_module $team_org ${TRYTOND_VERSION} $prefix "${get_trytonar[@]}" + inactive_modules_trytonar=( + documentacion-tryton-ar + tryton-demo-ar + tryton-capacitacion-tecnica + company_ar_NO_USAR + tryton-ar.github.io + deploy-localizacion-argentina_DEPRECATE + TUBA2015 + padron_afip_ar_DEPRECATE + ) + inactive_module $prefix $pip "${inactive_modules_trytonar[@]}" +fi + + +if [ ${Etrivial} = "True" ]; then + team_org="OneCluster" + branch="master" + apt-get install -y --no-install-recommends \ + build-essential \ + python3-dev \ + wget \ + && pip3 install --upgrade pip \ + && pip install numpy \ + matplotlib \ + && git clone -b ${branch} ${gitea_url}${team_org}/etrivial_transport \ + && mv etrivial_transport/transporte/trytond-modules/* ${DIR_MODULES} \ + && mv etrivial_transport/transporte/libraries/cliente_apps_civica /opt \ + && rm -rf etrivial_transport \ + && cd /opt/cliente_apps_civica \ + && python3.7 setup.py install +fi