From e410c5938f4c07d215eebbf37c17800266a35558 Mon Sep 17 00:00:00 2001 From: JJ-Cronos Date: Thu, 27 Mar 2025 12:20:01 +0200 Subject: [PATCH] feat: Update production image - Bump python to 3.12.3 - bump node to v22.14.0 - update dependencies from Frappe Docker repo - use custom-apps config from Frappe Docker Repo - Add rafnav apps to image - add prod build cmd to installation script --- images/production/Containerfile | 55 +++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/images/production/Containerfile b/images/production/Containerfile index c4eeff8b..b7a8d00f 100644 --- a/images/production/Containerfile +++ b/images/production/Containerfile @@ -1,12 +1,15 @@ -ARG PYTHON_VERSION=3.11.6 +ARG PYTHON_VERSION=3.12.3 ARG DEBIAN_BASE=bookworm FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base +COPY resources/nginx-template.conf /templates/nginx/frappe.conf.template +COPY resources/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh + ARG WKHTMLTOPDF_VERSION=0.12.6.1-3 ARG WKHTMLTOPDF_DISTRO=bookworm -ARG NODE_VERSION=18.18.2 +ARG NODE_VERSION=22.14.0 ENV NVM_DIR=/home/frappe/.nvm -ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} +ENV PATH=${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} RUN useradd -ms /bin/bash frappe \ && apt-get update \ @@ -65,10 +68,9 @@ RUN useradd -ms /bin/bash frappe \ && chown -R frappe:frappe /etc/nginx/nginx.conf \ && chown -R frappe:frappe /var/log/nginx \ && chown -R frappe:frappe /var/lib/nginx \ - && chown -R frappe:frappe /run/nginx.pid - -COPY resources/nginx-template.conf /templates/nginx/frappe.conf.template -COPY resources/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh + && chown -R frappe:frappe /run/nginx.pid \ + && chmod 755 /usr/local/bin/nginx-entrypoint.sh \ + && chmod 644 /templates/nginx/frappe.conf.template FROM base AS builder @@ -76,6 +78,12 @@ RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ # For frappe framework wget \ + #for building arm64 binaries + libcairo2-dev \ + libpango1.0-dev \ + libjpeg-dev \ + libgif-dev \ + librsvg2-dev \ # For psycopg2 libpq-dev \ # Other @@ -86,6 +94,7 @@ RUN apt-get update \ libsasl2-dev \ libtiff5-dev \ libwebp-dev \ + pkg-config \ redis-tools \ rlwrap \ tk8.6-dev \ @@ -96,26 +105,34 @@ RUN apt-get update \ libbz2-dev \ && rm -rf /var/lib/apt/lists/* +# apps.json includes +ARG APPS_JSON_BASE64 +RUN if [ -n "${APPS_JSON_BASE64}" ]; then \ + mkdir /opt/frappe && echo "${APPS_JSON_BASE64}" | base64 -d > /opt/frappe/apps.json; \ + fi + USER frappe ARG FRAPPE_BRANCH=version-15 ARG FRAPPE_PATH=https://github.com/frappe/frappe -ARG ERPNEXT_REPO=https://github.com/frappe/erpnext -ARG ERPNEXT_BRANCH=version-15 -RUN bench init \ - --frappe-branch=${FRAPPE_BRANCH} \ - --frappe-path=${FRAPPE_PATH} \ - --no-procfile \ - --no-backups \ - --skip-redis-config-generation \ - --verbose \ - /home/frappe/frappe-bench && \ +RUN export APP_INSTALL_ARGS="" && \ + if [ -n "${APPS_JSON_BASE64}" ]; then \ + export APP_INSTALL_ARGS="--apps_path=/opt/frappe/apps.json"; \ + fi && \ + bench init ${APP_INSTALL_ARGS}\ + --frappe-branch=${FRAPPE_BRANCH} \ + --frappe-path=${FRAPPE_PATH} \ + --no-procfile \ + --no-backups \ + --skip-redis-config-generation \ + --verbose \ + /home/frappe/frappe-bench && \ cd /home/frappe/frappe-bench && \ - bench get-app --branch=${ERPNEXT_BRANCH} --resolve-deps erpnext ${ERPNEXT_REPO} && \ echo "{}" > sites/common_site_config.json && \ + bench build --production \ find apps -mindepth 1 -path "*/.git" | xargs rm -fr -FROM base as erpnext +FROM base AS backend USER frappe