Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker builds for circular dependency in project #561

Merged
merged 4 commits into from
Jan 21, 2024

Conversation

anojht
Copy link
Contributor

@anojht anojht commented Jan 21, 2024

Due to the circular dependency of livewire JS module from composer, without intermediate build stages, the Docker build fails during the vite build step due to missing livewire module.

The changes here allow composer install to run then copies the vendor folder to an intermediate stage in order to complete the vite build with the livewire dependency being present.

Then the contents are copied back in another intermediate stage to the php environment to complete the build.

Due to the circular dependency of livewire JS module from composer, without intermediate build stages the Docker build fails during the vite build stage due to missing module.

The changes here allow composer install to run then copies the vendor folder to an intermediate stage in order to complete the vite build with the livewire dependency being present.

Then the contents are copied back in another intermediate stage to the php environment to complete the build.

Signed-off-by: Anojh Thayaparan <[email protected]>
@turbo124
Copy link
Member

@anojht

Thanks for this, i've been working on this also, however testing the build process here is failing for me also:

 => ERROR [dependencybuild 2/2] RUN --mount=target=/var/www/app/node_modules,type=cache  npm install  && npm run production  && mv /var/www/app/storage /var/www/app/docker-backup-storage/  && mv /var/www/app/public /var/www/app/docker-backup-public/           0.8s
------
 > [dependencybuild 2/2] RUN --mount=target=/var/www/app/node_modules,type=cache        npm install     && npm run production   && mv /var/www/app/storage /var/www/app/docker-backup-storage/  && mv /var/www/app/public /var/www/app/docker-backup-public/:
0.711 npm ERR! Tracker "idealTree" already exists
0.712 
0.712 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-01-21T06_31_19_252Z-debug-0.log
------
Dockerfile:108

@anojht
Copy link
Contributor Author

anojht commented Jan 21, 2024

@anojht

Thanks for this, i've been working on this also, however testing the build process here is failing for me also:

 => ERROR [dependencybuild 2/2] RUN --mount=target=/var/www/app/node_modules,type=cache  npm install  && npm run production  && mv /var/www/app/storage /var/www/app/docker-backup-storage/  && mv /var/www/app/public /var/www/app/docker-backup-public/           0.8s
------
 > [dependencybuild 2/2] RUN --mount=target=/var/www/app/node_modules,type=cache        npm install     && npm run production   && mv /var/www/app/storage /var/www/app/docker-backup-storage/  && mv /var/www/app/public /var/www/app/docker-backup-public/:
0.711 npm ERR! Tracker "idealTree" already exists
0.712 
0.712 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-01-21T06_31_19_252Z-debug-0.log
------
Dockerfile:108

Hi, it has been fixed, the WORKDIR had not been set before the npm install step. Sorry the Dockerfile in this repo is quite different than my own fork, where I originally implemented and tested the fix: anojht/invoiceninja, so it took a bit of time to adapt the fix.

@turbo124 turbo124 merged commit 0f9d399 into invoiceninja:master Jan 21, 2024
1 check passed
@turbo124
Copy link
Member

Thanks! looks good.

@anojht anojht deleted the patch-1 branch January 21, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants