File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,9 +38,6 @@ RUN useradd -d $GITHOME $GITUSER
3838RUN mkdir -p $GITHOME/.ssh && chown git:git $GITHOME/.ssh
3939RUN chown -R $GITUSER:$GITUSER $GITHOME
4040
41- # let the git user run `sudo /home/git/builder` (not writeable)
42- RUN echo "%git ALL=(ALL:ALL) NOPASSWD:/home/git/builder" >> /etc/sudoers
43-
4441# HACK: import progrium/cedarish as a tarball
4542# see https://github.com/deis/deis/issues/1027
4643RUN curl -#SL -o /progrium_cedarish.tar.gz \
@@ -56,6 +53,11 @@ CMD ["/app/bin/boot"]
5653EXPOSE 22
5754RUN addgroup --quiet --gid 2000 slug && useradd slug --uid=2000 --gid=2000
5855
56+ # $GITUSER is added to docker group to use docker without sudo and to slug
57+ # group in order to share resources with the slug user
58+ RUN usermod -a -G docker $GITUSER
59+ RUN usermod -a -G slug $GITUSER
60+
5961ADD templates/shim.dockerfile /home/git/
6062ADD etc /etc
6163ADD . /app
Original file line number Diff line number Diff line change @@ -94,12 +94,6 @@ BUILD_OPTS+=$(echo $RESPONSE | /app/bin/get-app-values)
9494# if no Dockerfile is present, use slugbuilder to compile a heroku slug
9595# and write out a Dockerfile to use that slug
9696if [ ! -f Dockerfile ]; then
97- if [ -f /buildpacks ]; then
98- BUILD_OPTS+=' -v /buildpacks:/tmp/buildpacks:rw'
99- # give non-root slugbuilder user R/W perms for docker volumes
100- chown -R 2000:2000 /buildpacks
101- fi
102-
10397 # run in the background, we'll attach to it to retrieve logs
10498 BUILD_OPTS+=' -d'
10599 BUILD_OPTS+=' -v '
@@ -108,8 +102,13 @@ if [ ! -f Dockerfile ]; then
108102 BUILD_OPTS+=' -v '
109103 BUILD_OPTS+=$( echo $CACHE_DIR )
110104 BUILD_OPTS+=' :/tmp/cache:rw'
111- # give non-root slugbuilder user R/W perms for docker volumes
112- chown -R 2000:2000 $TMP_DIR $CACHE_DIR
105+ # give slug group ownership of TMP_DIR and CACHE_DIR.
106+ chown -R :2000 $TMP_DIR
107+ chown :2000 $CACHE_DIR
108+ # TMP_DIR is created using mktemp, which sets permissions to 700. Since
109+ # we share this with the slug group, the slug group needs to be able to
110+ # work with it.
111+ chmod g+rwx $TMP_DIR
113112
114113 BUILD_OPTS+=' deis/slugbuilder'
115114
Original file line number Diff line number Diff line change 5757 cd $GITHOME
5858 # if we're processing a receive-pack on an existing repo, run a build
5959 if [[ $SSH_ORIGINAL_COMMAND == git-receive-pack* ]]; then
60- # SECURITY: git user runs the builder as root (for docker access)
61- sudo $GITHOME /builder $RECEIVE_USER $RECEIVE_REPO $newrev 2>&1 | strip_remote_prefix
60+ $GITHOME /builder $RECEIVE_USER $RECEIVE_REPO $newrev 2>&1 | strip_remote_prefix
6261 fi
6362
6463 rm -f " $LOCKFILE "
You can’t perform that action at this time.
0 commit comments