cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra-website] ossarga commented on a change in pull request #6: Make sure the home directory in the docker container has correct permissions
Date Wed, 29 Apr 2020 04:27:09 GMT

ossarga commented on a change in pull request #6:
URL: https://github.com/apache/cassandra-website/pull/6#discussion_r417058834



##########
File path: Dockerfile
##########
@@ -39,18 +39,19 @@ RUN gem install bundler && \
     bundle install && \
     rm /Gemfile /Gemfile.lock
 
-# Run as build user from here
-USER build
-
 ENV CASSANDRA_DIR="/home/build/cassandra"
 
 # Setup repositories to building the docs
-RUN mkdir -p /home/build/cassandra-site && \
-    git clone https://gitbox.apache.org/repos/asf/cassandra.git ${CASSANDRA_DIR}
+RUN mkdir -p /home/build/cassandra-site
+RUN git clone https://gitbox.apache.org/repos/asf/cassandra.git ${CASSANDRA_DIR}
+
+# hack: give build user rw access, eg on the asf websites jenkins agent
+RUN chmod -R a+rw /home/build/

Review comment:
       I think we should try and chain together the process for setting up the directories
to build the docs. The reason being is we prevent the container from caching these steps and
skipping them if one of the later steps changes. Further information about this can be found
in the [Dockerfile best practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run)
docs. [Stack Overflow](https://stackoverflow.com/questions/39223249/multiple-run-vs-single-chained-run-in-dockerfile-what-is-better)
has a good explanation about why we might want to do this as well.
   
   Given the operations we need to do now (i.e. change dir permissions), we should rework
this section to look something like this. It makes the operations easier to follow and more
maintainable.
   ```
   ENV BUILD_DIR="/home/build"
   
   # Setup directories for building the docs
   # As part of the setup give the build user rw access to the build directory and its children.
e.g. on the ASF websites jenkins agent.
   RUN mkdir -p ${BUILD_DIR}/cassandra-site && \
       git clone https://gitbox.apache.org/repos/asf/cassandra.git ${BUILD_DIR}/cassandra
&& \
       chmod -R a+rw ${BUILD_DIR}
   ```
   
   If we did the above, then we would replace the `ENV CASSANDRA_DIR` with the `ENV BUILD_DIR`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message