2020-08-07 09:58:15 +00:00
|
|
|
# This image uses nvm and same base image as the worker image.
|
|
|
|
# This is done to ensures that node-sass binary remains common.
|
|
|
|
# node-sass is required to enable website theme feature used
|
|
|
|
# by Website Manager role in Frappe Framework
|
2021-11-06 18:26:15 +00:00
|
|
|
ARG PYTHON_VERSION=3.9
|
2021-11-09 23:13:46 +00:00
|
|
|
FROM python:${PYTHON_VERSION}-slim-bullseye as builder
|
2020-08-06 17:08:52 +00:00
|
|
|
|
2021-05-21 09:00:55 +00:00
|
|
|
ARG GIT_REPO=https://github.com/frappe/frappe
|
|
|
|
ARG GIT_BRANCH=develop
|
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
ENV NODE_VERSION=14.18.1
|
2020-08-06 17:08:52 +00:00
|
|
|
ENV NVM_DIR=/root/.nvm
|
2021-11-09 23:13:46 +00:00
|
|
|
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
|
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install --no-install-recommends -y \
|
|
|
|
git \
|
|
|
|
build-essential \
|
|
|
|
wget \
|
|
|
|
python2 \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Install nvm with node and yarn
|
|
|
|
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
|
|
|
|
&& . ${NVM_DIR}/nvm.sh \
|
|
|
|
&& nvm install ${NODE_VERSION} \
|
|
|
|
&& npm install -g yarn \
|
|
|
|
&& rm -rf ${NVM_DIR}/.cache
|
2020-02-17 15:05:50 +00:00
|
|
|
|
|
|
|
WORKDIR /home/frappe/frappe-bench
|
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
RUN mkdir -p apps sites/assets/css sites/assets/frappe /var/www/error_pages
|
|
|
|
RUN echo "frappe" > sites/apps.txt
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
RUN git clone --depth 1 -b ${GIT_BRANCH} ${GIT_REPO} apps/frappe
|
|
|
|
RUN cd apps/frappe \
|
2020-10-02 00:41:46 +00:00
|
|
|
&& yarn \
|
|
|
|
&& yarn run production \
|
|
|
|
&& yarn install --production=true
|
|
|
|
|
2020-02-17 15:05:50 +00:00
|
|
|
RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \
|
|
|
|
&& cp -r /tmp/bench/bench/config/templates /var/www/error_pages
|
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
RUN cp -R apps/frappe/frappe/public/* sites/assets/frappe \
|
|
|
|
&& cp -R apps/frappe/node_modules sites/assets/frappe/
|
2020-02-17 15:05:50 +00:00
|
|
|
|
|
|
|
FROM nginx:latest
|
2021-11-09 23:13:46 +00:00
|
|
|
|
|
|
|
COPY --from=builder /home/frappe/frappe-bench/sites /var/www/html/
|
|
|
|
COPY --from=builder /var/www/error_pages /var/www/
|
2021-11-05 17:00:11 +00:00
|
|
|
COPY build/frappe-nginx/nginx-default.conf.template /etc/nginx/conf.d/default.conf.template
|
2020-03-03 23:40:11 +00:00
|
|
|
COPY build/frappe-nginx/docker-entrypoint.sh /
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install --no-install-recommends -y \
|
|
|
|
rsync \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
RUN echo "#!/bin/bash" > /rsync \
|
2020-03-19 23:51:30 +00:00
|
|
|
&& chmod +x /rsync
|
2020-02-17 15:05:50 +00:00
|
|
|
|
|
|
|
VOLUME [ "/assets" ]
|
|
|
|
|
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|