This is an automated email from the ASF dual-hosted git repository.
dzamo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new 00d0cb1 DRILL-8156: Declare and chown a /data VOLUME in the Drill
Dockerfile (#2491)
00d0cb1 is described below
commit 00d0cb18e63cfd010038ed590c725fbfba86f817
Author: James Turton <[email protected]>
AuthorDate: Sun Mar 13 17:26:51 2022 +0200
DRILL-8156: Declare and chown a /data VOLUME in the Drill Dockerfile (#2491)
* Add a mountpoint and VOLUME for local storage to Dockerfile.
* Address review comments concerning layer ordering.
* Fix image size blowup by moving chmod to intermediate container.
* Combine RUN commands in Dockerfile.
---
Dockerfile | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 996fb4f..20ba147 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -49,25 +49,32 @@ RUN mvn -Dmaven.artifact.threads=5 -T1C clean install
-DskipTests
# Get project version and copy built binaries into /opt/drill directory
RUN VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}'
--non-recursive exec:exec) \
&& mkdir /opt/drill \
- && mv distribution/target/apache-drill-${VERSION}/apache-drill-${VERSION}/*
/opt/drill
+ && mv distribution/target/apache-drill-${VERSION}/apache-drill-${VERSION}/*
/opt/drill \
+ && chmod -R +r /opt/drill
# Target image
# Set the BASE_IMAGE build arg when you invoke docker build.
FROM $BASE_IMAGE
-ENV DRILL_HOME=/opt/drill DRILL_USER=drilluser
+# Starts Drill in embedded mode and connects to Sqlline
+ENTRYPOINT $DRILL_HOME/bin/drill-embedded
-RUN mkdir $DRILL_HOME
+ENV DRILL_HOME=/opt/drill
+ENV DRILL_USER=drilluser
+ENV DRILL_USER_HOME=/var/lib/drill
+ENV DRILL_LOG_DIR=$DRILL_USER_HOME/log
+ENV DATA_VOL=/data
-RUN groupadd -g 999 $DRILL_USER \
- && useradd -r -u 999 -g $DRILL_USER $DRILL_USER -m -d /var/lib/drill \
- && chown -R $DRILL_USER: $DRILL_HOME
+RUN mkdir $DRILL_HOME $DATA_VOL \
+ && groupadd -g 999 $DRILL_USER \
+ && useradd -r -u 999 -g $DRILL_USER $DRILL_USER -m -d $DRILL_USER_HOME \
+ && chown $DRILL_USER: $DATA_VOL
-USER $DRILL_USER
+# A Docker volume where users may store persistent data, e.g. persistent Drill
+# config by specifying a Drill BOOT option of sys.store.provider.local.path:
"/data".
+VOLUME $DATA_VOL
-COPY --from=build --chown=$DRILL_USER /opt/drill $DRILL_HOME
-
-# Starts Drill in embedded mode and connects to Sqlline
-ENTRYPOINT $DRILL_HOME/bin/drill-embedded
+COPY --from=build /opt/drill $DRILL_HOME
+USER $DRILL_USER