I have dockerfile looks like :
RUN set -ex \
&& mkdir /home/app/cache-pool \
&& chown -R app:app /home/app/cache-pool \
&& mkdir /home/app/my-app \
&& chown -R app:app /home/app/my-app;
WORKDIR /home/app/my-app
RUN rm -vfr /home/app/cache-pool/*
RUN ln -s /home/app/cache-pool /home/app/my-app/public/page_cache
Exclude .dockerignore
/public/page_cache
I'm using docker compose to run the containers and mounting source code from host
services:
app:
...
volumes:
- ./:/home/app/my-app
based on that all sub-directories under /home/app/my-app
will replace by host include /home/app/my-app/public/..
also will break a created symlink on image even I create another volume to ignore it
ref : https://stackoverflow.com/a/37898591/1297435
services:
app:
...
volumes:
- ./:/home/app/my-app
- /home/app/my-app/public/page_cache
Do I need to re-symlink on docker compose entry point or any best way not to break symlink even I mount the source from host on volume?