fix: add --chown to Dockerfile COPY so RUN can write api/_version.py (#793)
The v0.50.124 Docker build failed with: cannot create /apptoo/api/_version.py: Permission denied Root cause: 'USER hermeswebuitoo' is set before 'COPY . /apptoo', but COPY without --chown creates files owned by root. The subsequent RUN step (which writes api/_version.py) runs as hermeswebuitoo and has no write permission to the root-owned api/ directory. Fix: COPY --chown=hermeswebuitoo:hermeswebuitoo so the unprivileged user owns the app files and can write _version.py at build time. Regression from #790. Co-authored-by: nesquena-hermes <hermes@nesquena.com>
This commit is contained in:
@@ -49,10 +49,13 @@ class TestDockerfileUvPreinstall:
|
||||
|
||||
def test_dockerfile_uv_installed_before_copy(self):
|
||||
"""uv installation must happen before COPY . /apptoo so it's in the image."""
|
||||
import re
|
||||
uv_pos = DOCKERFILE.find("uv/install.sh")
|
||||
copy_pos = DOCKERFILE.find("COPY . /apptoo")
|
||||
# Match COPY regardless of flags (e.g. --chown=...) — only the destination matters.
|
||||
m = re.search(r"^COPY\b.*\s/apptoo\b", DOCKERFILE, re.MULTILINE)
|
||||
assert uv_pos != -1, "uv install not found in Dockerfile"
|
||||
assert copy_pos != -1, "COPY . /apptoo not found in Dockerfile"
|
||||
assert m is not None, "COPY ... /apptoo not found in Dockerfile"
|
||||
copy_pos = m.start()
|
||||
assert uv_pos < copy_pos, "uv must be installed before COPY . /apptoo"
|
||||
|
||||
def test_dockerfile_uv_installed_as_root_or_before_user_switch(self):
|
||||
|
||||
Reference in New Issue
Block a user