2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-10 15:20:55 +00:00
frappe_docker/custom_app/frontend.Dockerfile
2021-12-16 22:34:11 +03:00

58 lines
1.4 KiB
Docker

ARG FRAPPE_VERSION
FROM node:14-bullseye-slim as prod_node_modules
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 /root/frappe-bench
RUN mkdir -p sites/assets
ARG FRAPPE_VERSION
RUN git clone --depth 1 -b ${FRAPPE_VERSION} https://github.com/frappe/frappe apps/frappe
RUN cd apps/frappe \
&& if [ "$(uname -m)" = "aarch64" ]; then \
yarn remove svg-sprite || true \
&& yarn add sass; \
fi \
&& yarn
ARG APP_NAME
COPY . apps/${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\n${APP_NAME}" >sites/apps.txt \
&& yarn --cwd apps/frappe production --app ${APP_NAME} \
&& rm sites/apps.txt
FROM frappe/frappe-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