2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-09-18 18:19:02 +00:00

Remove git reference from install-app (#742)

* Remove git reference from install-app
Also fixed issue with missing sites/assets folder

* Update custom app guide according to changes

* Ignore apps that have no frontend code instead of failing
This commit is contained in:
Lev 2022-03-30 12:09:09 +03:00 committed by GitHub
parent 6759bebab5
commit ca9761585a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 32 deletions

View File

@ -41,4 +41,6 @@ Cool! You just containerized your app!
## Installing multiple apps
Both backend and frontend builds contain `install-app` script that places app where it should be. Each call to script installs given app. Usage: `install-app [APP_NAME] [BRANCH?] [GIT_URL?]`.
Both backend and frontend builds contain `install-app` script that places app where it should be. Each call to script installs given app. Usage: `install-app [APP_NAME]`.
If you want to install an app from git, clone it locally, COPY in Dockerfile.

View File

@ -11,10 +11,4 @@ COPY . ../apps/${APP_NAME}
RUN --mount=type=cache,target=/root/.cache/pip \
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

@ -7,12 +7,6 @@ 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-app ${APP_NAME} ${BRANCH} ${GIT_URL}
FROM frappe/erpnext-nginx:${ERPNEXT_VERSION}

View File

@ -14,10 +14,9 @@ RUN mkdir -p sites/assets /out/assets \
&& echo frappe >sites/apps.txt
ARG FRAPPE_VERSION
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe
# Install development node modules
RUN yarn --cwd apps/frappe \
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \
&& yarn --cwd apps/frappe \
# TODO: Currently `yarn run production` doesn't create .build on develop branch: https://github.com/frappe/frappe/issues/15396
&& if [ ! -f sites/.build ]; then touch sites/.build; fi \
&& cp sites/.build /out
@ -33,7 +32,8 @@ RUN install-app frappe
FROM assets_builder as erpnext_assets
ARG ERPNEXT_VERSION
RUN install-app erpnext ${ERPNEXT_VERSION} https://github.com/frappe/erpnext
RUN git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \
&& install-app erpnext
FROM alpine/git as bench

View File

@ -2,13 +2,18 @@
set -e
set -x
APP=$1 BRANCH=$2 GIT_URL=$3
APP=$1
cleanup() {
rm -rf "apps/$APP"
rm -rf sites/assets/*
}
cd /frappe-bench
if test "$BRANCH" && test "$GIT_URL"; then
# Clone in case not copied manually
git clone --depth 1 -b "$BRANCH" "$GIT_URL" "apps/$APP"
if ! test -d "apps/$APP/$APP/public"; then
cleanup
exit 0
fi
# Add all not built assets
@ -24,6 +29,4 @@ echo "$APP" >>sites/apps.txt
yarn --cwd apps/frappe run production --app "$APP"
cp -r sites/assets /out
# Cleanup
rm -rf "apps/$APP"
rm -rf sites/assets
cleanup

View File

@ -43,7 +43,8 @@ FROM build_deps as frappe_builder
ARG FRAPPE_VERSION
RUN --mount=type=cache,target=/root/.cache/pip \
install-app frappe ${FRAPPE_VERSION} https://github.com/frappe/frappe \
git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \
&& install-app frappe \
&& env/bin/pip install -U gevent \
# Link Frappe's node_modules/ to make Website Theme work
&& mkdir -p /home/frappe/frappe-bench/sites/assets/frappe/node_modules \
@ -54,7 +55,8 @@ FROM frappe_builder as erpnext_builder
ARG ERPNEXT_VERSION
RUN --mount=type=cache,target=/root/.cache/pip \
install-app erpnext ${ERPNEXT_VERSION} https://github.com/frappe/erpnext
git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \
&& install-app erpnext
FROM base as configured_base

View File

@ -2,15 +2,11 @@
set -e
set -x
APP=$1 BRANCH=$2 GIT_URL=$3
APP=$1
cd /home/frappe/frappe-bench
if test "$BRANCH" && test "$GIT_URL"; then
# Clone in case not copied manually
git clone --depth 1 -b "$BRANCH" "$GIT_URL" "apps/$APP"
rm -r "apps/$APP/.git"
fi
rm -rf "apps/$APP/.git"
env/bin/pip install -e "apps/$APP"