2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-25 19:21:09 +00:00
frappe_docker/build/frappe-worker/Dockerfile

110 lines
3.2 KiB
Docker
Raw Normal View History

2021-11-06 18:26:15 +00:00
ARG PYTHON_VERSION=3.9
FROM python:${PYTHON_VERSION}-slim-bullseye
2020-02-10 08:00:54 +00:00
# Add non root user without password
2021-01-08 12:15:22 +00:00
RUN useradd -ms /bin/bash frappe
2020-06-27 18:14:13 +00:00
ARG GIT_REPO=https://github.com/frappe/frappe
2020-06-27 18:14:13 +00:00
ARG GIT_BRANCH=develop
2021-01-08 12:15:22 +00:00
ARG ARCH=amd64
ENV PYTHONUNBUFFERED 1
2020-06-27 18:14:13 +00:00
ENV NODE_VERSION=14.18.1
ENV NVM_DIR /home/frappe/.nvm
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
ENV WKHTMLTOPDF_VERSION 0.12.6-1
# Install apt dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
# For frappe framework
2020-02-10 08:00:54 +00:00
git \
mariadb-client \
2020-06-27 18:14:13 +00:00
postgresql-client \
2020-02-10 08:00:54 +00:00
gettext-base \
wget \
2021-01-08 12:15:22 +00:00
wait-for-it \
# For PDF
2020-06-27 18:14:13 +00:00
libjpeg62-turbo \
libx11-6 \
2020-06-27 18:14:13 +00:00
libxcb1 \
libxext6 \
libxrender1 \
2020-02-10 08:00:54 +00:00
libssl-dev \
fonts-cantarell \
2020-02-10 08:00:54 +00:00
xfonts-75dpi \
xfonts-base \
2021-01-08 12:15:22 +00:00
libxml2 \
libffi-dev \
libjpeg-dev \
zlib1g-dev \
2020-02-10 08:00:54 +00:00
# For psycopg2
libpq-dev \
2021-01-08 12:15:22 +00:00
# For arm64 python wheel builds
&& if [ "$(uname -m)" = "aarch64" ]; then \
apt-get install --no-install-recommends -y \
2021-01-08 12:15:22 +00:00
gcc \
g++; \
fi \
# Install additional requirements for develop branch
&& if [ "${GIT_BRANCH}" = 'develop' ]; then \
apt-get install --no-install-recommends -y \
libcairo2 \
python3-cffi \
python3-brotli \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libpangocairo-1.0-0; \
fi \
2021-08-10 16:03:08 +00:00
&& rm -rf /var/lib/apt/lists/*
2020-08-05 16:10:37 +00:00
# Detect arch, download and install wkhtmltopdf
RUN if [ "$(uname -m)" = "aarch64" ]; then export ARCH=arm64; fi \
&& if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; fi \
&& downloaded_file=wkhtmltox_$WKHTMLTOPDF_VERSION.buster_${ARCH}.deb \
&& wget -q https://github.com/wkhtmltopdf/packaging/releases/download/$WKHTMLTOPDF_VERSION/$downloaded_file \
&& dpkg -i $downloaded_file \
&& rm $downloaded_file
RUN chown -R frappe:frappe /home/frappe
2021-02-20 10:54:01 +00:00
# Setup docker-entrypoint
2021-11-05 17:00:11 +00:00
COPY build/frappe-worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
2021-02-20 10:54:01 +00:00
RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat
2020-08-05 16:10:37 +00:00
USER frappe
WORKDIR /home/frappe/frappe-bench
2020-02-10 08:00:54 +00:00
2020-06-27 18:14:13 +00:00
# Create frappe-bench directories
RUN mkdir -p apps logs commands sites /home/frappe/backups
2020-02-10 08:00:54 +00:00
2020-06-27 18:14:13 +00:00
# Setup python environment
RUN python -m venv env
RUN env/bin/pip install --no-cache-dir wheel gevent
# Install nvm with node
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
&& . ${NVM_DIR}/nvm.sh \
&& nvm install ${NODE_VERSION} \
&& rm -rf ${NVM_DIR}/.cache
# Install Frappe
RUN git clone --depth 1 -o upstream -b ${GIT_BRANCH} ${GIT_REPO} apps/frappe \
&& env/bin/pip install --no-cache-dir -e apps/frappe
2020-02-10 08:00:54 +00:00
2020-06-27 18:14:13 +00:00
# Copy scripts and templates
2021-11-05 17:00:11 +00:00
COPY build/frappe-worker/commands/* /home/frappe/frappe-bench/commands/
COPY build/frappe-worker/common_site_config.json.template /opt/frappe/common_site_config.json.template
COPY build/frappe-worker/install_app.sh /usr/local/bin/install_app
COPY build/frappe-worker/bench /usr/local/bin/bench
COPY build/frappe-worker/healthcheck.sh /usr/local/bin/healthcheck.sh
2020-02-10 08:00:54 +00:00
2020-06-27 18:14:13 +00:00
# Use sites volume as working directory
2020-02-10 08:00:54 +00:00
WORKDIR /home/frappe/frappe-bench/sites
2021-02-20 10:54:01 +00:00
VOLUME [ "/home/frappe/frappe-bench/sites", "/home/frappe/backups", "/home/frappe/frappe-bench/logs" ]
2020-02-10 08:00:54 +00:00
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["start"]