-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create intermediate directories in COPY with correct uid and gid (#2795)
* Create directories with the right UID/GID * Forgot to create the actual directory * Integration test creation of intermediate files with correct ownership * ADD version of the test
- Loading branch information
Showing
4 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
integration/dockerfiles/Dockerfile_test_add_chown_intermediate_dirs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM alpine@sha256:5ce5f501c457015c4b91f91a15ac69157d9b06f1a75cf9107bf2b62e0843983a | ||
# Create dev user and group, with id 1001 | ||
RUN yes | adduser -u 1001 dev | ||
|
||
ADD --chown=dev:dev context/foo /path/to/foo | ||
ADD --chown=dev:dev context/qux /path/to/qux | ||
ADD --chown=1001:1001 context/foo /path2/to/foo | ||
ADD --chown=1001:1001 context/qux /path2/to/qux | ||
|
||
USER dev | ||
|
||
# `mkdir` fails when `dev` does not own all of `/path{,2}/to{,/qux}` | ||
RUN mkdir /path/to/new_dir | ||
RUN mkdir /path/to/qux/new_dir | ||
RUN mkdir /path2/to/new_dir | ||
RUN mkdir /path2/to/qux/new_dir |
16 changes: 16 additions & 0 deletions
16
integration/dockerfiles/Dockerfile_test_copy_chown_intermediate_dirs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM alpine@sha256:5ce5f501c457015c4b91f91a15ac69157d9b06f1a75cf9107bf2b62e0843983a | ||
# Create dev user and group, with id 1001 | ||
RUN yes | adduser -u 1001 dev | ||
|
||
COPY --chown=dev:dev context/foo /path/to/foo | ||
COPY --chown=dev:dev context/qux /path/to/qux | ||
COPY --chown=1001:1001 context/foo /path2/to/foo | ||
COPY --chown=1001:1001 context/qux /path2/to/qux | ||
|
||
USER dev | ||
|
||
# `mkdir` fails when `dev` does not own all of `/path{,2}/to{,/qux}` | ||
RUN mkdir /path/to/new_dir | ||
RUN mkdir /path/to/qux/new_dir | ||
RUN mkdir /path2/to/new_dir | ||
RUN mkdir /path2/to/qux/new_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters