Update custom app builds according to new main dockerfiles

This commit is contained in:
Lev Vereshchagin 2022-03-20 20:41:00 +03:00
parent beb908903a
commit 7c624a3e2b
2 changed files with 21 additions and 30 deletions

View file

@ -1,8 +1,17 @@
ARG FRAPPE_VERSION
FROM frappe/erpnext-worker:${FRAPPE_VERSION}
ARG APP_NAME
COPY --chown=frappe . ../apps/${APP_NAME}
USER root
RUN echo "frappe\nerpnext\n${APP_NAME}" >/home/frappe/frappe-bench/sites/apps.txt \
&& ../env/bin/pip install --no-cache-dir -e ../apps/${APP_NAME}
ARG APP_NAME
COPY . ../apps/${APP_NAME}
RUN install-app ${APP_NAME}
# or with git:
# ARG APP_NAME
# ARG BRANCH
# ARG GIT_URL
# RUN install-assets ${APP_NAME} ${BRANCH} ${GIT_URL}
USER frappe

View file

@ -1,35 +1,17 @@
ARG FRAPPE_VERSION
FROM frappe/assets-builder:${FRAPPE_VERSION} as prod_node_modules
FROM frappe/assets-builder:${FRAPPE_VERSION} as assets
ARG APP_NAME
COPY . apps/${APP_NAME}
RUN install-app ${APP_NAME}
# Install production node modules
RUN yarn --cwd apps/${APP_NAME} --prod
FROM prod_node_modules as assets
ARG APP_NAME
# Install development node modules
RUN yarn --cwd apps/${APP_NAME}
# Build assets
RUN echo "frappe\nerpnext\n${APP_NAME}" >sites/apps.txt \
&& yarn --cwd apps/frappe production --app ${APP_NAME} \
&& rm sites/apps.txt
# or with git:
# ARG APP_NAME
# ARG BRANCH
# ARG GIT_URL
# RUN install-app ${APP_NAME} ${BRANCH} ${GIT_URL}
FROM frappe/erpnext-nginx:${FRAPPE_VERSION}
ARG APP_NAME
# Copy all not built assets
COPY --from=prod_node_modules /root/frappe-bench/apps/${APP_NAME}/${APP_NAME}/public /usr/share/nginx/html/assets/${APP_NAME}
# Copy production node modules
COPY --from=prod_node_modules /root/frappe-bench/apps/${APP_NAME}/node_modules /usr/share/nginx/html/assets/${APP_NAME}/node_modules
# Copy built assets
COPY --from=assets /root/frappe-bench/sites /usr/share/nginx/html
COPY --from=assets /out /usr/share/nginx/html