Skip to content

Commit c0ce667

Browse files
committed
Speed up Docker chown via COPY parameter
For some reason running the `chown` command explicitly is hanging on Docker. Using the `--chown` parameter in the `COPY` command is faster. However that new method has a couple of drawbacks: 1) it was introduced in a recent Docker version 17+ 2) it doesn't accept variables as argument, only hardcoded values Also note that we don't need to chmod `ANDROID_SDK_HOME` anymore.
1 parent b168978 commit c0ce667

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Dockerfile.py2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,9 @@ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
119119
RUN pip install --upgrade cython==0.28.6
120120

121121
WORKDIR ${WORK_DIR}
122-
COPY . ${WORK_DIR}
122+
COPY --chown=user:user . ${WORK_DIR}
123123

124124
# user needs ownership/write access to these directories
125-
RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
126125
USER ${USER}
127126

128127
# install python-for-android from current branch

Dockerfile.py3

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,9 @@ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
119119
RUN pip3 install --upgrade cython==0.28.6
120120

121121
WORKDIR ${WORK_DIR}
122-
COPY . ${WORK_DIR}
122+
COPY --chown=user:user . ${WORK_DIR}
123123

124124
# user needs ownership/write access to these directories
125-
RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
126125
USER ${USER}
127126

128127
# install python-for-android from current branch

0 commit comments

Comments
 (0)