Why does my .next folder end up owned by root instead of nonroot?

0
1
Asked By CuriousCoder88 On

I'm working on a Next.js app that's deployed using GitHub Actions, Kamal, and Docker. I keep running into an issue where the .next folder ends up owned by the root user, even though I've explicitly set the ownership to the nonroot user in the Dockerfile. Here's a breakdown of my Dockerfile stages:

1. In the **deps** stage, I set up the working directory and install dependencies using pnpm.
2. In the **builder** stage, I build the app and try to set ownership of the .next folder to nonroot using `chown`. Despite this, when I log into the container using `docker exec` and check the ownership with `ls -lAR .next`, it shows up as owned by root again.
3. I'm trying to figure out what might be causing the ownership to reset after the initial setup, possibly related to Kamal. Any insights would be appreciated!

1 Answer

Answered By DockerDude42 On

What command do you use to log in to your container? When you build your Dockerfile locally as opposed to through GitHub Actions, what's the difference in ownership? It might help narrow down the issue!

CuriousCoder88 -

I usually log in using `docker exec -it container_id /bin/bash` or check ownership directly with `docker exec -it container_id ls -ld /app/.next`. I expect the same result because it should be the same virtual environment, but the .next folder shows up owned by nonroot. I suspect Kamal might be resetting it, but I’m not sure how.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.