[projects/cleanbuild] docker: use separate stage for COPY

glen glen at pld-linux.org
Mon Dec 31 01:02:39 CET 2018


commit d27cf81936c5921f360ac2509853f706a4fb7a13
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Mon Dec 31 01:35:45 2018 +0200

    docker: use separate stage for COPY
    
    workaround for gitlab-runner umask issue
    
    https://gitlab.com/gitlab-org/gitlab-runner/issues/1736

 docker/Dockerfile | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/docker/Dockerfile b/docker/Dockerfile
index bf46e73..e78d4b8 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,7 +1,19 @@
 # create base image for cleanbuild
 
-FROM registry.gitlab.com/pld-linux/pld
+FROM registry.gitlab.com/pld-linux/pld AS base
 
+FROM base AS dist
+WORKDIR /dist
+
+COPY rpmmacros ./home/builder/.rpmmacros
+# overwrite with our config (it defines same path, but disabled)
+COPY localrpms.conf ./etc/poldek/source.conf
+
+# use sane permissions until solved upstream
+# https://gitlab.com/gitlab-org/gitlab-runner/issues/1736
+RUN chmod -R a+rX,og-w .
+
+FROM base
 RUN set -x \
 	# first upgrade to latest
 	&& poldek --upgrade-dist \
@@ -18,15 +30,11 @@ RUN set -x \
 	&& poldek-config keep_downloads yes \
 	&& poldek --clean-whole
 
-# overwrite with our config (it defines same path, but disabled)
-COPY localrpms.conf /etc/poldek/source.conf
+COPY --from=dist /dist /
 
 # switch user
 USER builder
-
-WORKDIR /home/services/builder
-
-COPY rpmmacros .rpmmacros
+WORKDIR /home/builder
 
 # Use sleep to run forever
 CMD ["sleep", "infinity"]
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/cleanbuild.git/commitdiff/8793c6127466e4784aaab5ba669818f454d90318



More information about the pld-cvs-commit mailing list