2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-10 17:24:43 +00:00
frappe_docker/build/nginx/Dockerfile

89 lines
2.6 KiB
Docker
Raw Normal View History

2021-12-13 16:25:40 +00:00
FROM node:14-bullseye-slim as base
RUN apt-get update \
2021-12-13 16:25:40 +00:00
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
git \
build-essential \
2021-12-13 16:25:40 +00:00
python \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
2021-12-13 16:25:40 +00:00
WORKDIR /root/frappe-bench
2021-12-16 18:41:31 +00:00
RUN mkdir -p sites/assets
2021-12-13 16:25:40 +00:00
ARG FRAPPE_VERSION
2021-12-16 18:41:31 +00:00
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe
2021-12-16 18:41:31 +00:00
FROM base as frappe_prod_node_modules
2021-12-16 18:41:31 +00:00
# Install production node modules
RUN yarn --cwd apps/frappe --prod
2021-12-16 18:41:31 +00:00
FROM frappe_prod_node_modules as frappe_assets
# Install development node modules
RUN cd apps/frappe && \
if [ "$(uname -m)" = "aarch64" ]; then \
yarn remove svg-sprite || true \
2021-12-13 16:25:40 +00:00
&& yarn add sass; \
fi \
&& yarn
2021-12-16 19:34:11 +00:00
# Build assets they're stored in frappe-bench/sites/assets
2021-12-16 18:41:31 +00:00
RUN echo "frappe" >sites/apps.txt \
&& yarn --cwd apps/frappe run production \
&& rm sites/apps.txt
2021-11-19 15:11:23 +00:00
2021-12-13 16:25:40 +00:00
2021-12-16 18:41:31 +00:00
FROM base as erpnext_prod_node_modules
2021-12-13 16:25:40 +00:00
ARG ERPNEXT_VERSION
2021-12-16 18:41:31 +00:00
RUN git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext
RUN yarn --cwd apps/erpnext --prod
2021-12-13 16:25:40 +00:00
2021-12-16 18:41:31 +00:00
FROM erpnext_prod_node_modules as erpnext_assets
2021-12-13 16:25:40 +00:00
2021-12-16 18:41:31 +00:00
RUN yarn --cwd apps/erpnext
2021-12-13 16:25:40 +00:00
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/
2021-12-16 18:41:31 +00:00
RUN echo "frappe\nerpnext" >sites/apps.txt \
&& yarn --cwd apps/frappe run production --app erpnext \
&& rm sites/apps.txt
2021-12-15 09:01:02 +00:00
FROM base as error_pages
RUN git clone --depth 1 https://github.com/frappe/bench /root/bench
2021-12-16 18:41:31 +00:00
FROM nginx:1.21-alpine as frappe
2021-12-15 09:01:02 +00:00
COPY --from=error_pages /root/bench/bench/config/templates/502.html /usr/share/nginx/html
2021-12-16 18:41:31 +00:00
COPY --from=base /root/frappe-bench/apps/frappe/frappe/public /usr/share/nginx/html/assets/frappe
COPY --from=frappe_prod_node_modules /root/frappe-bench/apps/frappe/node_modules /usr/share/nginx/html/assets/frappe/node_modules
COPY --from=frappe_assets /root/frappe-bench/sites /usr/share/nginx/html
2021-12-16 18:41:31 +00:00
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-16 18:41:31 +00:00
2021-12-13 16:25:40 +00:00
FROM frappe as erpnext
2021-12-16 18:41:31 +00:00
COPY --from=erpnext_prod_node_modules /root/frappe-bench/apps/erpnext/erpnext/public /usr/share/nginx/html/assets/erpnext
COPY --from=erpnext_prod_node_modules /root/frappe-bench/apps/erpnext/node_modules /usr/share/nginx/html/assets/erpnext/node_modules
2021-12-13 16:25:40 +00:00
COPY --from=erpnext_assets /root/frappe-bench/sites /usr/share/nginx/html