mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-27 09:15:10 +00:00
Add install-app script for backend build
This commit is contained in:
parent
051b196885
commit
7c194c2e30
2 changed files with 26 additions and 8 deletions
|
|
@ -36,14 +36,14 @@ RUN apt-get update \
|
||||||
make \
|
make \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY install-app.sh /usr/local/bin/install-app
|
||||||
|
|
||||||
|
|
||||||
FROM build_deps as frappe_builder
|
FROM build_deps as frappe_builder
|
||||||
|
|
||||||
ARG FRAPPE_VERSION
|
ARG FRAPPE_VERSION
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||||
git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe \
|
install-app frappe ${FRAPPE_VERSION} https://github.com/frappe/frappe \
|
||||||
&& rm -r apps/frappe/.git \
|
|
||||||
&& env/bin/pip install -e apps/frappe \
|
|
||||||
&& env/bin/pip install -U gevent \
|
&& env/bin/pip install -U gevent \
|
||||||
# Link Frappe's node_modules/ to make Website Theme work
|
# Link Frappe's node_modules/ to make Website Theme work
|
||||||
&& mkdir -p /home/frappe/frappe-bench/sites/assets/frappe/node_modules \
|
&& mkdir -p /home/frappe/frappe-bench/sites/assets/frappe/node_modules \
|
||||||
|
|
@ -54,9 +54,7 @@ FROM frappe_builder as erpnext_builder
|
||||||
|
|
||||||
ARG ERPNEXT_VERSION
|
ARG ERPNEXT_VERSION
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||||
git clone --depth 1 -b ${ERPNEXT_VERSION} https://github.com/frappe/erpnext apps/erpnext \
|
install-app erpnext ${ERPNEXT_VERSION} https://github.com/frappe/erpnext
|
||||||
&& rm -r apps/erpnext/.git \
|
|
||||||
&& env/bin/pip install -e apps/erpnext
|
|
||||||
|
|
||||||
|
|
||||||
FROM base as configured_base
|
FROM base as configured_base
|
||||||
|
|
@ -94,16 +92,19 @@ CMD [ "/home/frappe/frappe-bench/env/bin/gunicorn", "-b", "0.0.0.0:8000", "frapp
|
||||||
|
|
||||||
FROM configured_base as frappe
|
FROM configured_base as frappe
|
||||||
|
|
||||||
RUN echo frappe >/home/frappe/frappe-bench/sites/apps.txt
|
|
||||||
COPY --from=frappe_builder /home/frappe/frappe-bench/apps/frappe /home/frappe/frappe-bench/apps/frappe
|
COPY --from=frappe_builder /home/frappe/frappe-bench/apps/frappe /home/frappe/frappe-bench/apps/frappe
|
||||||
COPY --from=frappe_builder /home/frappe/frappe-bench/env /home/frappe/frappe-bench/env
|
COPY --from=frappe_builder /home/frappe/frappe-bench/env /home/frappe/frappe-bench/env
|
||||||
|
COPY --from=erpnext_builder /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/
|
||||||
|
|
||||||
USER frappe
|
USER frappe
|
||||||
|
|
||||||
|
|
||||||
# Split frappe and erpnext to reduce image size (because of frappe-bench/env/ directory)
|
# Split frappe and erpnext to reduce image size (because of frappe-bench/env/ directory)
|
||||||
FROM configured_base as erpnext
|
FROM configured_base as erpnext
|
||||||
|
|
||||||
RUN echo erpnext >>/home/frappe/frappe-bench/sites/apps.txt
|
|
||||||
COPY --from=frappe_builder /home/frappe/frappe-bench/apps/frappe /home/frappe/frappe-bench/apps/frappe
|
COPY --from=frappe_builder /home/frappe/frappe-bench/apps/frappe /home/frappe/frappe-bench/apps/frappe
|
||||||
COPY --from=erpnext_builder /home/frappe/frappe-bench/apps/erpnext /home/frappe/frappe-bench/apps/erpnext
|
COPY --from=erpnext_builder /home/frappe/frappe-bench/apps/erpnext /home/frappe/frappe-bench/apps/erpnext
|
||||||
COPY --from=erpnext_builder /home/frappe/frappe-bench/env /home/frappe/frappe-bench/env
|
COPY --from=erpnext_builder /home/frappe/frappe-bench/env /home/frappe/frappe-bench/env
|
||||||
|
COPY --from=erpnext_builder /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/
|
||||||
|
|
||||||
USER frappe
|
USER frappe
|
||||||
|
|
|
||||||
17
images/worker/install-app.sh
Executable file
17
images/worker/install-app.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
APP=$1 BRANCH=$2 GIT_URL=$3
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
env/bin/pip install -e "apps/$APP"
|
||||||
|
|
||||||
|
echo "$APP" >>sites/apps.txt
|
||||||
Loading…
Reference in a new issue