2021-01-05 09:17:01 +00:00
|
|
|
FROM python:3.7-slim-buster
|
2020-02-10 08:00:54 +00:00
|
|
|
|
2021-01-04 13:22:52 +00:00
|
|
|
# Add non root user without password
|
|
|
|
RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS -1/' /etc/login.defs \
|
|
|
|
&& sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS -1/' /etc/login.defs \
|
|
|
|
&& useradd -ms /bin/bash frappe
|
2020-06-27 18:14:13 +00:00
|
|
|
|
|
|
|
ARG GIT_BRANCH=develop
|
2021-01-05 12:18:54 +00:00
|
|
|
ARG ARCH=amd64
|
2020-06-28 00:28:45 +00:00
|
|
|
ENV PYTHONUNBUFFERED 1
|
2020-08-05 16:10:37 +00:00
|
|
|
ENV NVM_DIR=/home/frappe/.nvm
|
2021-01-04 13:24:11 +00:00
|
|
|
ENV NODE_VERSION=12.20.0
|
2020-08-05 16:10:37 +00:00
|
|
|
ENV PATH="/home/frappe/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
|
2020-06-27 18:14:13 +00:00
|
|
|
|
|
|
|
# Install dependencies
|
2020-02-10 08:00:54 +00:00
|
|
|
WORKDIR /home/frappe/frappe-bench
|
2021-01-05 09:17:01 +00:00
|
|
|
RUN apt-get update -y && apt-get install \
|
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-05 12:18:54 +00:00
|
|
|
curl \
|
2020-02-10 08:00:54 +00:00
|
|
|
# for PDF
|
2021-01-05 09:17:01 +00:00
|
|
|
fonts-cantarell \
|
|
|
|
libffi-dev \
|
|
|
|
libjpeg-dev \
|
2020-06-27 18:14:13 +00:00
|
|
|
libjpeg62-turbo \
|
|
|
|
libxcb1 \
|
|
|
|
libxext6 \
|
2021-01-05 09:17:01 +00:00
|
|
|
libx11-6 \
|
|
|
|
libxml2 \
|
2020-06-27 18:14:13 +00:00
|
|
|
libxrender1 \
|
2020-02-10 08:00:54 +00:00
|
|
|
libssl-dev \
|
|
|
|
xfonts-75dpi \
|
|
|
|
xfonts-base \
|
2021-01-05 09:17:01 +00:00
|
|
|
zlib1g-dev \
|
2020-02-10 08:00:54 +00:00
|
|
|
# For psycopg2
|
|
|
|
libpq-dev \
|
2021-01-05 16:32:00 +00:00
|
|
|
wait-for-it \
|
|
|
|
# For arm64
|
|
|
|
gcc -y \
|
2021-01-05 18:44:25 +00:00
|
|
|
&& if [ `uname -m` = 'aarch64' ]; then export ARCH=arm64; fi \
|
|
|
|
&& if [ `uname -m` = 'x86_64' ]; then export ARCH=amd64; fi \
|
2021-01-05 12:18:54 +00:00
|
|
|
&& wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
|
|
|
|
&& dpkg -i wkhtmltox_0.12.6-1.buster_${ARCH}.deb && rm wkhtmltox_0.12.6-1.buster_${ARCH}.deb \
|
2021-01-05 09:17:01 +00:00
|
|
|
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh \
|
2020-08-05 16:10:37 +00:00
|
|
|
&& apt-get purge -y wget && apt-get autoremove -y \
|
|
|
|
&& chown -R frappe:frappe /home/frappe
|
|
|
|
|
|
|
|
USER frappe
|
|
|
|
# Install nvm with node
|
|
|
|
RUN bash install.sh \
|
|
|
|
&& . "$NVM_DIR/nvm.sh" \
|
|
|
|
&& nvm install ${NODE_VERSION} \
|
|
|
|
&& nvm use v${NODE_VERSION} \
|
|
|
|
&& nvm alias default v${NODE_VERSION}
|
2020-02-10 08:00:54 +00:00
|
|
|
|
2020-06-27 18:14:13 +00:00
|
|
|
# Create frappe-bench directories
|
2020-03-27 11:11:32 +00:00
|
|
|
RUN mkdir -p apps logs commands /home/frappe/backups
|
2020-02-10 08:00:54 +00:00
|
|
|
|
2020-06-27 18:14:13 +00:00
|
|
|
# Setup python environment
|
2020-06-28 00:25:15 +00:00
|
|
|
RUN python -m venv env \
|
2020-02-10 08:00:54 +00:00
|
|
|
&& . env/bin/activate \
|
|
|
|
&& cd apps \
|
2020-06-27 18:14:13 +00:00
|
|
|
&& git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch ${GIT_BRANCH} \
|
2020-06-28 02:10:33 +00:00
|
|
|
&& pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe
|
2020-02-10 08:00:54 +00:00
|
|
|
|
2020-08-05 16:10:37 +00:00
|
|
|
USER root
|
2020-06-27 18:14:13 +00:00
|
|
|
# Copy scripts and templates
|
2020-02-20 12:31:23 +00:00
|
|
|
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
|
|
|
|
COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template
|
2020-06-27 18:14:13 +00:00
|
|
|
COPY build/common/worker/install_app.sh /usr/local/bin/install_app
|
2020-08-29 18:36:56 +00:00
|
|
|
COPY build/common/worker/bench /usr/local/bin/bench
|
2020-09-15 17:48:28 +00:00
|
|
|
COPY build/common/worker/healthcheck.sh /usr/local/bin/healthcheck.sh
|
2020-02-10 08:00:54 +00:00
|
|
|
|
|
|
|
# Setup docker-entrypoint
|
2020-02-20 12:31:23 +00:00
|
|
|
COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
2020-02-10 08:00:54 +00:00
|
|
|
RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat
|
|
|
|
|
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
|
|
|
|
|
2020-06-27 18:14:13 +00:00
|
|
|
# Set ownership of sites directory
|
2020-08-05 16:10:37 +00:00
|
|
|
RUN chown -R frappe:frappe /home/frappe/frappe-bench/sites
|
2020-03-17 17:01:37 +00:00
|
|
|
|
2020-03-27 11:11:32 +00:00
|
|
|
VOLUME [ "/home/frappe/frappe-bench/sites", "/home/frappe/backups" ]
|
2020-03-17 17:01:37 +00:00
|
|
|
|
2020-02-10 08:00:54 +00:00
|
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
|
|
CMD ["start"]
|