2021-12-13 16:25:40 +00:00
|
|
|
FROM node:14-bullseye-slim as base
|
2021-11-09 23:13:46 +00:00
|
|
|
|
|
|
|
RUN apt-get update \
|
2021-12-13 16:25:40 +00:00
|
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
2021-11-09 23:13:46 +00:00
|
|
|
git \
|
|
|
|
build-essential \
|
2021-12-13 16:25:40 +00:00
|
|
|
python \
|
|
|
|
ca-certificates \
|
2021-11-09 23:13:46 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
WORKDIR /root/frappe-bench
|
|
|
|
RUN mkdir -p apps sites/assets/frappe
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
ARG FRAPPE_VERSION
|
|
|
|
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \
|
|
|
|
&& echo "frappe" >sites/apps.txt
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
WORKDIR /root/frappe-bench/apps/frappe
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2020-10-02 00:41:46 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
FROM base as frappe_node_modules
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
RUN yarn --prod
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-11-09 23:13:46 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
FROM frappe_node_modules as frappe_assets
|
2021-11-18 16:53:54 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
RUN if [ "$(uname -m)" = "aarch64" ]; then \
|
2021-12-13 16:27:56 +00:00
|
|
|
yarn remove svg-sprite || true \
|
2021-12-13 16:25:40 +00:00
|
|
|
&& yarn add sass; \
|
|
|
|
fi \
|
|
|
|
&& yarn
|
2021-11-18 16:53:54 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
RUN yarn run production \
|
|
|
|
&& cp -R frappe/public/* ../../sites/assets/frappe \
|
|
|
|
&& rm ../../sites/apps.txt
|
2021-11-19 15:11:23 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
# Get rid of development node modules
|
|
|
|
COPY --from=frappe_node_modules /root/frappe-bench/apps/frappe/node_modules /root/frappe-bench/sites/assets/frappe/
|
|
|
|
|
|
|
|
|
|
|
|
FROM base as erpnext_node_modules
|
|
|
|
|
|
|
|
ARG ERPNEXT_VERSION
|
|
|
|
RUN cd ../.. \
|
|
|
|
&& git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \
|
|
|
|
&& echo "frappe\nerpnext" >sites/apps.txt
|
|
|
|
|
|
|
|
RUN yarn --cwd ../erpnext --prod
|
|
|
|
|
|
|
|
|
|
|
|
FROM erpnext_node_modules as erpnext_assets
|
|
|
|
|
2021-12-15 07:06:44 +00:00
|
|
|
RUN mkdir -p ../../sites/assets/erpnext
|
|
|
|
RUN yarn --cwd ../erpnext
|
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
# Reuse development node_modules from frappe_assets
|
|
|
|
COPY --from=frappe_assets /root/frappe-bench/apps/frappe/node_modules /root/frappe-bench/apps/frappe/node_modules
|
|
|
|
COPY --from=frappe_assets /root/frappe-bench/apps/frappe/package.json /root/frappe-bench/apps/frappe/yarn.lock /root/frappe-bench/apps/frappe/
|
|
|
|
|
|
|
|
RUN yarn run production --app erpnext \
|
|
|
|
&& cp -R ../erpnext/erpnext/public/* ../../sites/assets/erpnext \
|
|
|
|
&& rm ../../sites/apps.txt
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
# Get rid of development node modules
|
|
|
|
COPY --from=erpnext_node_modules /root/frappe-bench/apps/erpnext/node_modules /root/frappe-bench/apps/erpnext/node_modules
|
2020-02-17 15:05:50 +00:00
|
|
|
|
2021-11-18 16:53:54 +00:00
|
|
|
|
2021-12-15 07:06:44 +00:00
|
|
|
FROM nginx:1.21-alpine as frappe
|
|
|
|
|
|
|
|
COPY --from=frappe_assets /root/frappe-bench/sites /usr/share/nginx/html
|
|
|
|
COPY nginx-template.conf /
|
|
|
|
|
|
|
|
CMD [ "/bin/sh" , "-c" , "envsubst '${BACKEND} ${SOCKETIO} ${FRAPPE_SITE_NAME_HEADER}' </nginx-template.conf >/etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'" ]
|
|
|
|
|
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
FROM frappe as erpnext
|
2021-11-18 16:53:54 +00:00
|
|
|
|
2021-12-13 16:25:40 +00:00
|
|
|
COPY --from=erpnext_assets /root/frappe-bench/sites /usr/share/nginx/html
|