1616FROM openjdk:8-jre-alpine3.8
1717MAINTAINER Apache Knox <dev@knox.apache.org>
1818
19+ USER root
1920# Make sure required packages are available
20- RUN apk --no-cache add bash procps ca-certificates krb5 && update-ca-certificates
21+ RUN apk upgrade --no-cache && \
22+ apk add --no-cache openssl \
23+ procps \
24+ ca-certificates \
25+ unzip \
26+ nss && \
27+ apk add --no-cache bash
2128
22- # Create an knox user
23- RUN addgroup -S knox && adduser -S -G knox knox
29+ # Create knox user and group
30+ # Using GID 8000 for the knox group to allow arbitrary UIDs with this GID
31+ RUN groupadd --system -g 8000 knox && adduser --system -u 8000 -g knox -h /home/knox knox
2432
2533# Dependencies
2634ARG RELEASE_FILE
27- COPY ${RELEASE_FILE} /home/knox/
35+ ADD --chown=knox:knox ${RELEASE_FILE} /home/knox/
2836
2937# Extract the Knox release tar.gz
30- RUN cd /home/knox && unzip /home/knox/*.zip && rm -f /home/knox/*.zip && ln -nsf /home/knox/*/ /home/knox/knox
38+ RUN chmod 644 /home/knox/*.zip && \
39+ cd /home/knox && unzip /home/knox/*.zip && rm -f /home/knox/*.zip && ln -nsf /home/knox/*/ /home/knox/knox
3140
32- # Make sure knox owns its files
33- RUN chown -R knox: /home/knox
41+ # Make sure knox owns its files and make all directories group-accessible for arbitrary UIDs
42+ RUN mkdir -p /home/knox/knox/data/security/keystores && \
43+ mkdir -p /home/knox/knox/conf && \
44+ chown -R knox:knox /home/knox && \
45+ chmod -R g+rwX /home/knox \
3446
3547# Add the entrypoint script
3648ARG ENTRYPOINT
@@ -44,7 +56,9 @@ ADD --chown=knox:knox \
4456 http://www.awstrust.com/repository/AmazonRootCA2.cer \
4557 http://www.awstrust.com/repository/AmazonRootCA3.cer \
4658 http://www.awstrust.com/repository/AmazonRootCA4.cer \
47- http://letsencrypt.org/certs/staging/letsencrypt-stg-root-x1.pem /home/knox/cacrts/
59+ http://letsencrypt.org/certs/staging/letsencrypt-stg-root-x1.pem \
60+ https://letsencrypt.org/certs/isrgrootx1.pem \
61+ https://letsencrypt.org/certs/isrg-root-x2.pem /home/knox/cacrts/
4862
4963WORKDIR /home/knox/knox
5064
@@ -54,5 +68,4 @@ EXPOSE ${EXPOSE_PORT}
5468
5569# Switch off of the root user
5670USER knox
57-
5871ENTRYPOINT ["./entrypoint.sh" ]
0 commit comments