mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-17 13:55:08 +00:00
fix(assets): link assets at container init
This commit is contained in:
parent
473f08a7f9
commit
64e6536592
4 changed files with 48 additions and 0 deletions
|
|
@ -146,11 +146,23 @@ COPY --from=builder --chown=frappe:frappe /home/frappe/frappe-bench /home/frappe
|
|||
|
||||
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 +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
USER frappe
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
|
||||
CMD [ \
|
||||
"/home/frappe/frappe-bench/env/bin/gunicorn", \
|
||||
"--chdir=/home/frappe/frappe-bench/sites", \
|
||||
|
|
|
|||
|
|
@ -35,11 +35,23 @@ COPY --from=builder --chown=frappe:frappe /home/frappe/frappe-bench /home/frappe
|
|||
|
||||
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 +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
USER frappe
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
|
||||
CMD [ \
|
||||
"/home/frappe/frappe-bench/env/bin/gunicorn", \
|
||||
"--chdir=/home/frappe/frappe-bench/sites", \
|
||||
|
|
|
|||
|
|
@ -136,11 +136,23 @@ COPY --from=builder --chown=frappe:frappe /home/frappe/frappe-bench /home/frappe
|
|||
|
||||
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 +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
USER frappe
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
|
||||
CMD [ \
|
||||
"/home/frappe/frappe-bench/env/bin/gunicorn", \
|
||||
"--chdir=/home/frappe/frappe-bench/sites", \
|
||||
|
|
|
|||
12
resources/core/main-entrypoint.sh
Executable file
12
resources/core/main-entrypoint.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
ASSETS_PATH="/home/frappe/frappe-bench/sites/assets"
|
||||
BAKED_PATH="/home/frappe/frappe-bench/assets"
|
||||
|
||||
echo "Linking fresh assets to volume..."
|
||||
rm -rf "$ASSETS_PATH"
|
||||
mkdir -p "$(dirname "$ASSETS_PATH")"
|
||||
ln -s "$BAKED_PATH" "$ASSETS_PATH"
|
||||
|
||||
exec "$@"
|
||||
Loading…
Reference in a new issue