mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-17 13:55:08 +00:00
58 lines
1.7 KiB
Docker
58 lines
1.7 KiB
Docker
ARG FRAPPE_BRANCH=version-16
|
|
ARG FRAPPE_IMAGE_PREFIX=frappe
|
|
|
|
FROM ${FRAPPE_IMAGE_PREFIX}/build:${FRAPPE_BRANCH} AS builder
|
|
|
|
ARG FRAPPE_BRANCH=version-16
|
|
ARG FRAPPE_PATH=https://github.com/frappe/frappe
|
|
ARG CACHE_BUST=""
|
|
|
|
USER frappe
|
|
|
|
RUN --mount=type=secret,id=apps_json,target=/opt/frappe/apps.json,uid=1000,gid=1000 \
|
|
: "${CACHE_BUST}" && \
|
|
export APP_INSTALL_ARGS="" && \
|
|
if [ -f /opt/frappe/apps.json ] && [ -s /opt/frappe/apps.json ]; then \
|
|
export APP_INSTALL_ARGS="--apps_path=/opt/frappe/apps.json"; \
|
|
fi && \
|
|
bench init ${APP_INSTALL_ARGS}\
|
|
--frappe-branch=${FRAPPE_BRANCH} \
|
|
--frappe-path=${FRAPPE_PATH} \
|
|
--no-procfile \
|
|
--no-backups \
|
|
--skip-redis-config-generation \
|
|
--verbose \
|
|
/home/frappe/frappe-bench && \
|
|
cd /home/frappe/frappe-bench && \
|
|
echo "{}" > sites/common_site_config.json && \
|
|
find apps -mindepth 1 -path "*/.git" | xargs rm -fr
|
|
|
|
FROM ${FRAPPE_IMAGE_PREFIX}/base:${FRAPPE_BRANCH} AS backend
|
|
|
|
USER frappe
|
|
|
|
COPY --from=builder --chown=frappe:frappe /home/frappe/frappe-bench /home/frappe/frappe-bench
|
|
|
|
WORKDIR /home/frappe/frappe-bench
|
|
|
|
# Move assets to image-layer storage
|
|
RUN cp -r /home/frappe/frappe-bench/sites/assets /home/frappe/frappe-bench/assets && \
|
|
rm -rf /home/frappe/frappe-bench/sites/assets
|
|
|
|
VOLUME [ \
|
|
"/home/frappe/frappe-bench/sites", \
|
|
"/home/frappe/frappe-bench/logs" \
|
|
]
|
|
|
|
USER root
|
|
# This entrypoint script link build assets of the image to the mounted sites volume at container initialization
|
|
COPY resources/core/main-entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod 755 /usr/local/bin/entrypoint.sh
|
|
|
|
COPY resources/core/start.sh /usr/local/bin/start.sh
|
|
RUN chmod 755 /usr/local/bin/start.sh
|
|
|
|
USER frappe
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
|
CMD ["start.sh"]
|