2022-09-12 08:50:05 +00:00
|
|
|
FROM frappe/bench:latest as assets_builder
|
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-10-19 08:52:07 +00:00
|
|
|
ARG PYTHON_VERSION
|
|
|
|
ARG NODE_VERSION
|
|
|
|
ENV NVM_DIR=/home/frappe/.nvm
|
|
|
|
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
|
|
|
|
RUN PYENV_VERSION=${PYTHON_VERSION} bench init --version=${FRAPPE_VERSION} --frappe-path=${FRAPPE_REPO} --skip-redis-config-generation --verbose --skip-assets /home/frappe/frappe-bench
|
2022-03-14 05:53:03 +00:00
|
|
|
|
2022-09-12 08:50:05 +00:00
|
|
|
WORKDIR /home/frappe/frappe-bench
|
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-09-12 08:50:05 +00:00
|
|
|
RUN bench setup requirements \
|
|
|
|
&& if [ -z "${FRAPPE_VERSION##*v14*}" ] || [ "$FRAPPE_VERSION" = "develop" ]; then \
|
|
|
|
export BUILD_OPTS="--production";\
|
|
|
|
fi \
|
|
|
|
&& FRAPPE_ENV=production bench build --verbose --hard-link ${BUILD_OPTS}
|
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-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-09-12 08:50:05 +00:00
|
|
|
RUN bench get-app --branch=${ERPNEXT_VERSION} --skip-assets --resolve-deps erpnext ${ERPNEXT_REPO}\
|
|
|
|
&& if [ -z "${ERPNEXT_VERSION##*v14*}" ] || [ "$ERPNEXT_VERSION" = "develop" ]; then \
|
|
|
|
export BUILD_OPTS="--production"; \
|
2022-08-02 00:31:13 +00:00
|
|
|
fi \
|
2022-09-12 08:50:05 +00:00
|
|
|
&& FRAPPE_ENV=production bench build --verbose --hard-link ${BUILD_OPTS}
|
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 \
|
2022-09-12 08:50:05 +00:00
|
|
|
&& mv /tmp/bench/bench/config/templates/502.html /out \
|
|
|
|
&& touch /out/.build
|
2022-03-14 05:53:03 +00:00
|
|
|
|
2022-10-21 16:19:32 +00:00
|
|
|
FROM nginxinc/nginx-unprivileged:1.23.2-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/
|
2022-09-12 08:50:05 +00:00
|
|
|
COPY --from=frappe_assets /home/frappe/frappe-bench/sites/assets /usr/share/nginx/html/assets
|
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-09-12 08:50:05 +00:00
|
|
|
COPY --from=erpnext_assets /home/frappe/frappe-bench/sites/assets /usr/share/nginx/html/assets
|