This commit is contained in:
martkaczmarek 2026-06-10 11:56:20 +02:00 committed by GitHub
commit 0bf24b657f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 0 deletions

View file

@ -96,6 +96,7 @@ See [Automated Builds and Deployment](../03-production/06-automated-builds-and-d
| PYTHON_VERSION | Python version for the base image | | PYTHON_VERSION | Python version for the base image |
| NODE_VERSION | Node.js version | | NODE_VERSION | Node.js version |
| WKHTMLTOPDF_VERSION | wkhtmltopdf version | | WKHTMLTOPDF_VERSION | wkhtmltopdf version |
| INSTALL_PYCUPS | Set true to install pycups and its dependencies; see <https://docs.frappe.io/erpnext/print-settings> |
| INSTALL_CHROMIUM | Configure chromium installation, defaults to `true` - needed for Frappe Workbench version >15 | | INSTALL_CHROMIUM | Configure chromium installation, defaults to `true` - needed for Frappe Workbench version >15 |
| **bench only** | | | **bench only** | |
| DEBIAN_BASE | Debian base version for the bench image, defaults to `bookworm` | | DEBIAN_BASE | Debian base version for the bench image, defaults to `bookworm` |

View file

@ -5,6 +5,7 @@ LABEL author=frappé
ARG GIT_REPO=https://github.com/frappe/bench.git ARG GIT_REPO=https://github.com/frappe/bench.git
ARG GIT_BRANCH=v5.x ARG GIT_BRANCH=v5.x
ARG INSTALL_CHROMIUM=true ARG INSTALL_CHROMIUM=true
ARG INSTALL_PYCUPS=false
RUN apt-get update \ RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ && 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 \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
chromium-headless-shell; \ chromium-headless-shell; \
fi \ fi \
# Install cups
&& if [ "$INSTALL_PYCUPS" != "false" ]; then apt-get install -y libcups2-dev; fi \
&& rm -rf /var/lib/apt/lists/* && 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 \ 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 --path)"' >>~/.profile \
&& echo 'eval "$(pyenv init -)"' >>~/.bashrc && 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 # Clone and install bench in the local user home directory
# For development, bench source is located in ~/.bench # For development, bench source is located in ~/.bench
ENV PATH=/home/frappe/.local/bin:$PATH 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/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 && 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 EXPOSE 8000-8005 9000-9005 6787

View file

@ -13,6 +13,7 @@ ARG INSTALL_CHROMIUM=true
ARG NODE_VERSION=24.13.0 ARG NODE_VERSION=24.13.0
ENV NVM_DIR=/home/frappe/.nvm 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}
ARG INSTALL_PYCUPS=false
RUN useradd -ms /bin/bash frappe \ RUN useradd -ms /bin/bash frappe \
&& apt-get update \ && 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 \ && curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \
&& apt-get install -y ./$downloaded_file \ && apt-get install -y ./$downloaded_file \
&& rm $downloaded_file \ && rm $downloaded_file \
# Install cups
&& if [ "$INSTALL_PYCUPS" != "false" ]; then apt-get install -y libcups2-dev; fi \
# Chromium # Chromium
&& if [ "$INSTALL_CHROMIUM" != "false" ]; then \ && if [ "$INSTALL_CHROMIUM" != "false" ]; then \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ 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 \ && rm -fr /etc/nginx/sites-enabled/default \
&& mkdir -p /etc/nginx/snippets \ && mkdir -p /etc/nginx/snippets \
&& pip3 install frappe-bench \ && 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 # Fixes for non-root nginx and logs to stdout
&& sed -i '/user www-data/d' /etc/nginx/nginx.conf \ && 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 \ && 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 \ libbz2-dev \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
USER frappe USER frappe
ARG FRAPPE_BRANCH=version-16 ARG FRAPPE_BRANCH=version-16

View file

@ -9,6 +9,7 @@ ARG INSTALL_CHROMIUM=true
ARG NODE_VERSION=24.13.0 ARG NODE_VERSION=24.13.0
ENV NVM_DIR=/home/frappe/.nvm 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}
ARG INSTALL_PYCUPS=false
RUN useradd -ms /bin/bash frappe \ RUN useradd -ms /bin/bash frappe \
&& apt-get update \ && 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 \ && curl -sLO https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \
&& apt-get install -y ./$downloaded_file \ && apt-get install -y ./$downloaded_file \
&& rm $downloaded_file \ && rm $downloaded_file \
# Install cups
&& if [ "$INSTALL_PYCUPS" != "false" ]; then apt-get install -y libcups2-dev; fi \
# Chromium # Chromium
&& if [ "$INSTALL_CHROMIUM" != "false" ]; then \ && if [ "$INSTALL_CHROMIUM" != "false" ]; then \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ 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 \ && rm -fr /etc/nginx/sites-enabled/default \
&& mkdir -p /etc/nginx/snippets \ && mkdir -p /etc/nginx/snippets \
&& pip3 install frappe-bench \ && 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 # Fixes for non-root nginx and logs to stdout
&& sed -i '/user www-data/d' /etc/nginx/nginx.conf \ && 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 \ && 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 \ libbz2-dev \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
USER frappe USER frappe
FROM build AS builder FROM build AS builder