diff --git a/.travis.yml b/.travis.yml index 355180a7..9bb9b583 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,36 @@ jobs: script: - ./travis.py erpnext --nginx --tag edge - ./travis.py erpnext --nginx --tag develop --tag-only + - stage: "Frappe (v13-beta)" + if: branch = master AND type != pull_request + script: + - ./travis.py frappe --worker --git-version 13-beta + - ./travis.py frappe --worker --tag v13-beta --tag-only + - ./travis.py frappe --worker --tag version-13-beta --tag-only + - stage: "Frappe (v13-beta)" + if: branch = master AND type != pull_request + script: + - ./travis.py frappe --nginx --git-version 13-beta + - ./travis.py frappe --nginx --tag v13-beta --tag-only + - ./travis.py frappe --nginx --tag version-13-beta --tag-only + - stage: "Frappe (v13-beta)" + if: branch = master AND type != pull_request + script: + - ./travis.py frappe --socketio --git-version 13-beta + - ./travis.py frappe --socketio --tag v13-beta --tag-only + - ./travis.py frappe --socketio --tag version-13-beta --tag-only + - stage: "ERPNext (v13-beta)" + if: branch = master AND type != pull_request + script: + - ./travis.py erpnext --worker --git-version 13-beta + - ./travis.py erpnext --worker --tag v13-beta --tag-only + - ./travis.py erpnext --worker --tag version-13-beta --tag-only + - stage: "ERPNext (v13-beta)" + if: branch = master AND type != pull_request + script: + - ./travis.py erpnext --nginx --git-version 13-beta + - ./travis.py erpnext --nginx --tag v13-beta --tag-only + - ./travis.py erpnext --nginx --tag version-13-beta --tag-only - stage: "Frappe (v12)" if: branch = master AND type != pull_request script: diff --git a/build/erpnext-nginx/v13-beta.Dockerfile b/build/erpnext-nginx/v13-beta.Dockerfile new file mode 100644 index 00000000..952859aa --- /dev/null +++ b/build/erpnext-nginx/v13-beta.Dockerfile @@ -0,0 +1,16 @@ +FROM bitnami/node:12-prod + +COPY build/erpnext-nginx/install_app.sh /install_app + +RUN /install_app erpnext https://github.com/frappe/erpnext version-13-beta + +FROM frappe/frappe-nginx:v13-beta + +COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ +COPY --from=0 /rsync /rsync +RUN echo -n "\nerpnext" >> /var/www/html/apps.txt + +VOLUME [ "/assets" ] + +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/build/erpnext-worker/v13-beta.Dockerfile b/build/erpnext-worker/v13-beta.Dockerfile new file mode 100644 index 00000000..cfb4ca08 --- /dev/null +++ b/build/erpnext-worker/v13-beta.Dockerfile @@ -0,0 +1,3 @@ +FROM frappe/frappe-worker:v13-beta + +RUN install_app erpnext https://github.com/frappe/erpnext version-13-beta \ No newline at end of file diff --git a/build/frappe-nginx/v13-beta.Dockerfile b/build/frappe-nginx/v13-beta.Dockerfile new file mode 100644 index 00000000..1a6577bc --- /dev/null +++ b/build/frappe-nginx/v13-beta.Dockerfile @@ -0,0 +1,52 @@ +FROM bitnami/node:12-prod + +WORKDIR /home/frappe/frappe-bench +RUN mkdir -p /home/frappe/frappe-bench/sites \ + && echo "frappe" > /home/frappe/frappe-bench/sites/apps.txt + +RUN install_packages git + +RUN mkdir -p apps sites/assets/css \ + && cd apps \ + && git clone --depth 1 https://github.com/frappe/frappe --branch version-13-beta + +COPY build/frappe-nginx/generate_standard_style_css.js \ + /home/frappe/frappe-bench/apps/frappe/generate_standard_style_css.js + +RUN cd /home/frappe/frappe-bench/apps/frappe \ + && yarn \ + && yarn run production \ + && yarn add nunjucks -D \ + && node generate_standard_style_css.js \ + frappe/website/doctype/website_theme/website_theme_template.scss > \ + /home/frappe/standard_templates_string \ + && node generate_bootstrap_theme.js \ + /home/frappe/frappe-bench/sites/assets/css/standard_style.css \ + "$(cat /home/frappe/standard_templates_string)" \ + && rm -fr node_modules \ + && yarn install --production=true \ + && node --version \ + && npm --version \ + && yarn --version + +RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \ + && mkdir -p /var/www/error_pages \ + && cp -r /tmp/bench/bench/config/templates /var/www/error_pages + +RUN cp -R /home/frappe/frappe-bench/apps/frappe/frappe/public/* /home/frappe/frappe-bench/sites/assets/frappe \ + && cp -R /home/frappe/frappe-bench/apps/frappe/node_modules /home/frappe/frappe-bench/sites/assets/frappe/ + +FROM nginx:latest +COPY --from=0 /home/frappe/frappe-bench/sites /var/www/html/ +COPY --from=0 /var/www/error_pages /var/www/ +COPY build/common/nginx-default.conf.template /etc/nginx/conf.d/default.conf.template +COPY build/frappe-nginx/docker-entrypoint.sh / + +RUN apt-get update && apt-get install -y rsync && apt-get clean \ + && echo "#!/bin/bash" > /rsync \ + && chmod +x /rsync + +VOLUME [ "/assets" ] + +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/build/frappe-socketio/v13-beta.Dockerfile b/build/frappe-socketio/v13-beta.Dockerfile new file mode 100644 index 00000000..4ae4f7ea --- /dev/null +++ b/build/frappe-socketio/v13-beta.Dockerfile @@ -0,0 +1,36 @@ +FROM node:slim + +# Install needed packages +RUN apt-get update && apt-get install -y curl && apt-get clean + +RUN useradd -ms /bin/bash frappe + +# Make bench directories +RUN mkdir -p /home/frappe/frappe-bench/sites /home/frappe/frappe-bench/apps/frappe + +COPY build/frappe-socketio/package.json /home/frappe/frappe-bench/apps/frappe + + +# get socketio +RUN cd /home/frappe/frappe-bench/apps/frappe \ + && curl https://raw.githubusercontent.com/frappe/frappe/version-13-beta/socketio.js \ + --output /home/frappe/frappe-bench/apps/frappe/socketio.js \ + && curl https://raw.githubusercontent.com/frappe/frappe/version-13-beta/node_utils.js \ + --output /home/frappe/frappe-bench/apps/frappe/node_utils.js + +RUN cd /home/frappe/frappe-bench/apps/frappe \ + && npm install --only=production \ + && node --version \ + && npm --version + +COPY build/frappe-socketio/health.js /home/frappe/frappe-bench/apps/frappe/health.js +RUN chown -R frappe:frappe /home/frappe + +# Setup docker-entrypoint +COPY build/frappe-socketio/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat + +WORKDIR /home/frappe/frappe-bench/sites + +ENTRYPOINT ["docker-entrypoint.sh"] +CMD ["start"] diff --git a/build/frappe-worker/v13-beta.Dockerfile b/build/frappe-worker/v13-beta.Dockerfile new file mode 100644 index 00000000..1f2ed290 --- /dev/null +++ b/build/frappe-worker/v13-beta.Dockerfile @@ -0,0 +1,48 @@ +FROM bitnami/python:latest-prod + +RUN useradd -ms /bin/bash frappe +WORKDIR /home/frappe/frappe-bench +RUN install_packages \ + git \ + wkhtmltopdf \ + mariadb-client \ + gettext-base \ + wget \ + # for PDF + libssl-dev \ + fonts-cantarell \ + xfonts-75dpi \ + xfonts-base \ + # For psycopg2 + libpq-dev \ + build-essential + +# Install wkhtmltox correctly +RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb +RUN dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb && rm wkhtmltox_0.12.5-1.stretch_amd64.deb + +RUN mkdir -p apps logs commands /home/frappe/backups + +RUN virtualenv env \ + && . env/bin/activate \ + && cd apps \ + && git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch version-13-beta \ + && pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe + +COPY build/common/commands/* /home/frappe/frappe-bench/commands/ +COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template + +# Setup docker-entrypoint +COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat + +COPY build/common/worker/install_app.sh /usr/local/bin/install_app + +WORKDIR /home/frappe/frappe-bench/sites + +RUN chown -R frappe:frappe /home/frappe/frappe-bench/sites /home/frappe/backups + +VOLUME [ "/home/frappe/frappe-bench/sites", "/home/frappe/backups" ] + +ENTRYPOINT ["docker-entrypoint.sh"] +CMD ["start"] diff --git a/travis.py b/travis.py index 02101369..a9cb936e 100755 --- a/travis.py +++ b/travis.py @@ -15,7 +15,7 @@ image_type.add_argument('-s', '--socketio', action='store_const', dest='image_ty image_type.add_argument('-w', '--worker', action='store_const', dest='image_type', const='worker', help='Build the python environment image') tag_type = parser.add_mutually_exclusive_group(required=True) -tag_type.add_argument('-g', '--git-version', action='store', type=int, dest='version', help='The version number of --service (i.e. "11", "12", etc.)') +tag_type.add_argument('-g', '--git-version', action='store', type=str, dest='version', help='The version number of --service (i.e. "11", "12", etc.)') tag_type.add_argument('-t', '--tag', action='store', type=str, dest='tag', help='The image tag (i.e. erpnext-worker:$TAG )') args = parser.parse_args() @@ -26,6 +26,10 @@ def git_version(service, version): cd = os.getcwd() os.chdir(os.getcwd() + f'/{service}') subprocess.run('git fetch --tags', shell=True) + + # XX-beta becomes XX for tags search + version = version.split('-')[0] + version_tag = subprocess.check_output(f'git tag --list --sort=-version:refname "v{version}*" | sed -n 1p | sed -e \'s#.*@\(\)#\\1#\'', shell=True).strip().decode('ascii') os.chdir(cd) return version_tag