Deprecate assets builder (#922)
* feat: remove assets-builder image * ci: remove version 12 builds * fix: v13 nginx builds
This commit is contained in:
committed by
GitHub
parent
2c1e5425b6
commit
ec584ba9c8
@@ -1,46 +1,30 @@
|
||||
FROM node:14-bullseye-slim as assets_builder
|
||||
|
||||
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/*
|
||||
|
||||
WORKDIR /frappe-bench
|
||||
|
||||
RUN mkdir -p sites/assets /out/assets \
|
||||
&& echo frappe >sites/apps.txt
|
||||
FROM frappe/bench:latest as assets_builder
|
||||
|
||||
ARG FRAPPE_VERSION
|
||||
ARG FRAPPE_REPO=https://github.com/frappe/frappe
|
||||
# Install development node modules
|
||||
RUN git clone --depth 1 -b ${FRAPPE_VERSION} ${FRAPPE_REPO} 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
|
||||
RUN bench init --version=${FRAPPE_VERSION} --frappe-path=${FRAPPE_REPO} --skip-redis-config-generation --verbose --skip-assets /home/frappe/frappe-bench
|
||||
|
||||
COPY install-app.sh /usr/local/bin/install-app
|
||||
WORKDIR /home/frappe/frappe-bench
|
||||
|
||||
|
||||
FROM assets_builder as frappe_assets
|
||||
|
||||
RUN install-app frappe
|
||||
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}
|
||||
|
||||
|
||||
FROM assets_builder as erpnext_assets
|
||||
|
||||
ARG PAYMENTS_VERSION=develop
|
||||
ARG PAYMENTS_REPO=https://github.com/frappe/payments
|
||||
ARG ERPNEXT_VERSION
|
||||
ARG ERPNEXT_REPO=https://github.com/frappe/erpnext
|
||||
RUN if [ -z "${ERPNEXT_VERSION##*v14*}" ] || [ "$ERPNEXT_VERSION" = "develop" ]; then \
|
||||
git clone --depth 1 -b ${PAYMENTS_VERSION} ${PAYMENTS_REPO} apps/payments && install-app payments; \
|
||||
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"; \
|
||||
fi \
|
||||
&& git clone --depth 1 -b ${ERPNEXT_VERSION} ${ERPNEXT_REPO} apps/erpnext \
|
||||
&& install-app erpnext
|
||||
&& FRAPPE_ENV=production bench build --verbose --hard-link ${BUILD_OPTS}
|
||||
|
||||
|
||||
FROM alpine/git as bench
|
||||
@@ -49,8 +33,8 @@ FROM alpine/git as bench
|
||||
ARG BENCH_REPO=https://github.com/frappe/bench
|
||||
RUN git clone --depth 1 ${BENCH_REPO} /tmp/bench \
|
||||
&& mkdir /out \
|
||||
&& mv /tmp/bench/bench/config/templates/502.html /out/
|
||||
|
||||
&& mv /tmp/bench/bench/config/templates/502.html /out \
|
||||
&& touch /out/.build
|
||||
|
||||
FROM nginxinc/nginx-unprivileged:1.23.1-alpine as frappe
|
||||
|
||||
@@ -60,11 +44,11 @@ COPY nginx-template.conf /etc/nginx/templates/default.conf.template
|
||||
COPY entrypoint.sh /docker-entrypoint.d/frappe-entrypoint.sh
|
||||
|
||||
COPY --from=bench /out /usr/share/nginx/html/
|
||||
COPY --from=frappe_assets /out /usr/share/nginx/html
|
||||
COPY --from=frappe_assets /home/frappe/frappe-bench/sites/assets /usr/share/nginx/html/assets
|
||||
|
||||
USER 1000
|
||||
|
||||
|
||||
FROM frappe as erpnext
|
||||
|
||||
COPY --from=erpnext_assets /out /usr/share/nginx/html
|
||||
COPY --from=erpnext_assets /home/frappe/frappe-bench/sites/assets /usr/share/nginx/html/assets
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
APP=$1
|
||||
|
||||
cleanup() {
|
||||
rm -rf "apps/$APP"
|
||||
rm -rf sites/assets/*
|
||||
}
|
||||
|
||||
cd /frappe-bench
|
||||
|
||||
if ! test -d "apps/$APP/$APP/public"; then
|
||||
cleanup
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Add all not built assets
|
||||
cp -r "apps/$APP/$APP/public" "/out/assets/$APP"
|
||||
|
||||
# Add production node modules
|
||||
yarn --cwd "apps/$APP" --prod
|
||||
cp -r "apps/$APP/node_modules" "/out/assets/$APP/node_modules"
|
||||
|
||||
# Add built assets
|
||||
yarn --cwd "apps/$APP"
|
||||
echo "$APP" >>sites/apps.txt
|
||||
yarn --cwd apps/frappe run production --app "$APP"
|
||||
cp -r sites/assets /out
|
||||
|
||||
cleanup
|
||||
Reference in New Issue
Block a user