diff --git a/docs/02-setup/02-build-setup.md b/docs/02-setup/02-build-setup.md index 09cef899..fca70dfa 100644 --- a/docs/02-setup/02-build-setup.md +++ b/docs/02-setup/02-build-setup.md @@ -96,6 +96,7 @@ See [Automated Builds and Deployment](../03-production/06-automated-builds-and-d | PYTHON_VERSION | Python version for the base image | | NODE_VERSION | Node.js version | | WKHTMLTOPDF_VERSION | wkhtmltopdf version | +| INSTALL_PYCUPS | Set true to install pycups and its dependencies; see | | INSTALL_CHROMIUM | Configure chromium installation, defaults to `true` - needed for Frappe Workbench version >15 | | **bench only** | | | DEBIAN_BASE | Debian base version for the bench image, defaults to `bookworm` | diff --git a/images/bench/Dockerfile b/images/bench/Dockerfile index 2b2540b5..500e6b24 100644 --- a/images/bench/Dockerfile +++ b/images/bench/Dockerfile @@ -5,6 +5,7 @@ LABEL author=frappé ARG GIT_REPO=https://github.com/frappe/bench.git ARG GIT_BRANCH=v5.x ARG INSTALL_CHROMIUM=true +ARG INSTALL_PYCUPS=false RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ @@ -79,6 +80,8 @@ RUN apt-get update \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ chromium-headless-shell; \ fi \ + # Install cups + && if [ "$INSTALL_PYCUPS" != "false" ]; then apt-get install -y libcups2-dev; fi \ && rm -rf /var/lib/apt/lists/* RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ @@ -121,6 +124,10 @@ RUN git clone --depth 1 https://github.com/pyenv/pyenv.git .pyenv \ && echo 'eval "$(pyenv init --path)"' >>~/.profile \ && echo 'eval "$(pyenv init -)"' >>~/.bashrc + + # Install pycups +RUN if [ "$INSTALL_PYCUPS" != "false" ]; then pip install --no-cache-dir pycups; fi \ + # Clone and install bench in the local user home directory # For development, bench source is located in ~/.bench ENV PATH=/home/frappe/.local/bin:$PATH @@ -151,6 +158,8 @@ RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \ && echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> ~/.bashrc +# Install pycups +RUN if [ "$INSTALL_PYCUPS" != "false" ]; then /home/frappe/frappe-bench/env/bin/pip install --no-cache-dir pycups; fi EXPOSE 8000-8005 9000-9005 6787 diff --git a/images/custom/Containerfile b/images/custom/Containerfile index 70e4317b..d98c29c4 100644 --- a/images/custom/Containerfile +++ b/images/custom/Containerfile @@ -13,6 +13,7 @@ ARG INSTALL_CHROMIUM=true ARG NODE_VERSION=24.13.0 ENV NVM_DIR=/home/frappe/.nvm ENV PATH=${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} +ARG INSTALL_PYCUPS=false RUN useradd -ms /bin/bash frappe \ && apt-get update \ @@ -62,6 +63,8 @@ RUN useradd -ms /bin/bash frappe \ && curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \ && apt-get install -y ./$downloaded_file \ && rm $downloaded_file \ + # Install cups + && if [ "$INSTALL_PYCUPS" != "false" ]; then apt-get install -y libcups2-dev; fi \ # Chromium && if [ "$INSTALL_CHROMIUM" != "false" ]; then \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ @@ -72,6 +75,8 @@ RUN useradd -ms /bin/bash frappe \ && rm -fr /etc/nginx/sites-enabled/default \ && mkdir -p /etc/nginx/snippets \ && pip3 install frappe-bench \ + # Install pycups + && if [ "$INSTALL_PYCUPS" != "false" ]; then pip install --no-cache-dir pycups; fi \ # Fixes for non-root nginx and logs to stdout && sed -i '/user www-data/d' /etc/nginx/nginx.conf \ && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log \ @@ -119,6 +124,8 @@ RUN apt-get update \ libbz2-dev \ && rm -rf /var/lib/apt/lists/* + + USER frappe ARG FRAPPE_BRANCH=version-16 diff --git a/images/production/Containerfile b/images/production/Containerfile index b30dd957..ff7bcb5e 100644 --- a/images/production/Containerfile +++ b/images/production/Containerfile @@ -9,6 +9,7 @@ ARG INSTALL_CHROMIUM=true ARG NODE_VERSION=24.13.0 ENV NVM_DIR=/home/frappe/.nvm ENV PATH=${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} +ARG INSTALL_PYCUPS=false RUN useradd -ms /bin/bash frappe \ && apt-get update \ @@ -58,6 +59,8 @@ RUN useradd -ms /bin/bash frappe \ && curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \ && apt-get install -y ./$downloaded_file \ && rm $downloaded_file \ + # Install cups + && if [ "$INSTALL_PYCUPS" != "false" ]; then apt-get install -y libcups2-dev; fi \ # Chromium && if [ "$INSTALL_CHROMIUM" != "false" ]; then \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ @@ -68,6 +71,8 @@ RUN useradd -ms /bin/bash frappe \ && rm -fr /etc/nginx/sites-enabled/default \ && mkdir -p /etc/nginx/snippets \ && pip3 install frappe-bench \ + # Install pycups + && if [ "$INSTALL_PYCUPS" != "false" ]; then /home/frappe/frappe-bench/env/bin/pip install --no-cache-dir pycups; fi \ # Fixes for non-root nginx and logs to stdout && sed -i '/user www-data/d' /etc/nginx/nginx.conf \ && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log \ @@ -111,6 +116,8 @@ RUN apt-get update \ libbz2-dev \ && rm -rf /var/lib/apt/lists/* + + USER frappe FROM build AS builder