2022-03-23 08:43:47 +00:00
|
|
|
FROM node:14-bullseye-slim as assets_builder
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
|
|
|
git \
|
|
|
|
build-essential \
|
|
|
|
python \
|
|
|
|
ca-certificates \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
WORKDIR /frappe-bench
|
|
|
|
|
|
|
|
RUN mkdir -p sites/assets /out/assets \
|
|
|
|
&& echo frappe >sites/apps.txt
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
ARG FRAPPE_VERSION
|
2022-04-11 05:00:16 +00:00
|
|
|
ARG FRAPPE_REPO=https://github.com/frappe/frappe
|
2022-03-14 05:53:03 +00:00
|
|
|
# Install development node modules
|
2022-04-11 05:00:16 +00:00
|
|
|
RUN git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} apps/frappe \
|
2022-03-30 09:09:09 +00:00
|
|
|
&& yarn --cwd apps/frappe \
|
2022-03-14 05:53:03 +00:00
|
|
|
# TODO: Currently `yarn run production` doesn't create .build on develop branch: https://github.com/frappe/frappe/issues/15396
|
2022-03-23 08:43:47 +00:00
|
|
|
&& if [ ! -f sites/.build ]; then touch sites/.build; fi \
|
|
|
|
&& cp sites/.build /out
|
2022-03-14 05:53:03 +00:00
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
COPY install-app.sh /usr/local/bin/install-app
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
FROM assets_builder as frappe_assets
|
2022-03-14 05:53:03 +00:00
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
RUN install-app frappe
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
FROM assets_builder as erpnext_assets
|
2022-03-14 05:53:03 +00:00
|
|
|
|
2022-08-02 00:31:13 +00:00
|
|
|
ARG PAYMENTS_VERSION=develop
|
|
|
|
ARG PAYMENTS_REPO=https://github.com/frappe/payments
|
2022-03-23 08:43:47 +00:00
|
|
|
ARG ERPNEXT_VERSION
|
2022-04-11 05:00:16 +00:00
|
|
|
ARG ERPNEXT_REPO=https://github.com/frappe/erpnext
|
2022-08-02 00:31:13 +00:00
|
|
|
RUN if [ -z "${ERPNEXT_VERSION##*v14*}" ] || [ "$ERPNEXT_VERSION" = "develop" ]; then \
|
|
|
|
git clone --depth 1 -b ${PAYMENTS_VERSION} ${PAYMENTS_REPO} apps/payments && install-app payments; \
|
|
|
|
fi \
|
|
|
|
&& git clone --depth 1 -b ${ERPNEXT_VERSION} ${ERPNEXT_REPO} apps/erpnext \
|
2022-03-30 09:09:09 +00:00
|
|
|
&& install-app erpnext
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
FROM alpine/git as bench
|
2022-03-14 05:53:03 +00:00
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
# Error pages
|
2022-04-11 05:00:16 +00:00
|
|
|
ARG BENCH_REPO=https://github.com/frappe/bench
|
|
|
|
RUN git clone --depth 1 ${BENCH_REPO} /tmp/bench \
|
2022-03-23 08:43:47 +00:00
|
|
|
&& mkdir /out \
|
|
|
|
&& mv /tmp/bench/bench/config/templates/502.html /out/
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
|
2022-07-22 11:48:08 +00:00
|
|
|
FROM nginxinc/nginx-unprivileged:1.23.1-alpine as frappe
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/20-envsubst-on-templates.sh
|
|
|
|
COPY nginx-template.conf /etc/nginx/templates/default.conf.template
|
|
|
|
# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/docker-entrypoint.sh
|
|
|
|
COPY entrypoint.sh /docker-entrypoint.d/frappe-entrypoint.sh
|
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
COPY --from=bench /out /usr/share/nginx/html/
|
|
|
|
COPY --from=frappe_assets /out /usr/share/nginx/html
|
2022-03-14 05:53:03 +00:00
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
USER 1000
|
2022-03-14 05:53:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
FROM frappe as erpnext
|
|
|
|
|
2022-03-23 08:43:47 +00:00
|
|
|
COPY --from=erpnext_assets /out /usr/share/nginx/html
|