Skip to content

Commit

Permalink
Re-structured RUN commands
Browse files Browse the repository at this point in the history
Chaining of RUN commands done to decrease the image size
  • Loading branch information
sarit-si committed Apr 27, 2021
1 parent ca991d2 commit 313ca06
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions setup-pentaho/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM openjdk:8-jre

LABEL maintainer="[email protected]" \
version="1.0" \
version="1.1" \
description="Docker file builds container with Pentaho Data Integration & Carte Server"

# Set PDI user with permissions same as the Host machine.
Expand All @@ -20,20 +20,13 @@ ENV PDI_RELEASE=9.1 \
PATH=${KETTLE_HOME}:${PATH}

# Create Pentaho user home directory and required sub-folders
RUN mkdir -p ${PENTAHO_HOME}/templates ${PENTAHO_HOME}/scripts

# Copy all required configs and entrypoint files
COPY carte-*-config.xml ${PENTAHO_HOME}/templates/
COPY docker-entrypoint.sh ${PENTAHO_HOME}/scripts/

RUN mkdir -p ${PENTAHO_HOME}/templates ${PENTAHO_HOME}/scripts \
# Create Pentaho group passed as PENTAHO_GID arg
RUN command groupadd -r ${PENTAHO_GID} \
&& groupadd -r ${PENTAHO_GID} \
# Create Pentaho user with PENTAHO_UID same as Host UID, and assign to new group
&& useradd -s /bin/bash -d ${PENTAHO_HOME} -r -g ${PENTAHO_GID} -u ${PENTAHO_UID} pentaho

# Pentaho download and setup
&& useradd -s /bin/bash -d ${PENTAHO_HOME} -r -g ${PENTAHO_GID} -u ${PENTAHO_UID} pentaho \
# Download PDI and save in PENTAHO_HOME
RUN /usr/bin/wget --progress=dot:giga \
&& /usr/bin/wget --progress=dot:giga \
https://sourceforge.net/projects/pentaho/files/Pentaho%20${PDI_RELEASE}/client-tools/pdi-ce-${PDI_VERSION}.zip \
-P ${PENTAHO_HOME} \
# Unzip PDI to /opt/ directory
Expand All @@ -43,20 +36,25 @@ RUN /usr/bin/wget --progress=dot:giga \
# Create directory for the kettle.properties file
&& mkdir ${KETTLE_HOME}/.kettle \
# Make pentaho user owner of both PENTAHO_HOME and KETTLE_HOME directories
&& chown -R pentaho ${PENTAHO_HOME} ${KETTLE_HOME} \
&& chown -R pentaho ${PENTAHO_HOME} ${KETTLE_HOME}

# Copy carte configs and docker entrypoint file
COPY carte-*-config.xml ${PENTAHO_HOME}/templates/
COPY docker-entrypoint.sh ${PENTAHO_HOME}/scripts/

# Make entrypoint as executable
&& chmod +x ${PENTAHO_HOME}/scripts/docker-entrypoint.sh
RUN chmod +x ${PENTAHO_HOME}/scripts/docker-entrypoint.sh

# Install App dependent packages, if any
# Download MySQL JDBC Connector to PENTAHO_HOME
RUN /usr/bin/wget --progress=dot:giga \
https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.49.zip -P ${PENTAHO_HOME} \
# Unzip MySQL jar file
&& /usr/bin/unzip -q ${PENTAHO_HOME}/mysql-connector-java-5.1.49.zip -d ${PENTAHO_HOME} \
# Copy unzipped jar file to /opt/data-integration
&& cp ${PENTAHO_HOME}/mysql-connector-java-5.1.49/mysql-connector-java-5.1.49-bin.jar /opt/data-integration/lib \
# Clean up downloaded files
&& rm -R ${PENTAHO_HOME}/mysql-connector*
# # Install App dependent packages, if any
# # Download MySQL JDBC Connector to PENTAHO_HOME
# RUN /usr/bin/wget --progress=dot:giga \
# https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.49.zip -P ${PENTAHO_HOME} \
# # Unzip MySQL jar file
# && /usr/bin/unzip -q ${PENTAHO_HOME}/mysql-connector-java-5.1.49.zip -d ${PENTAHO_HOME} \
# # Copy unzipped jar file to /opt/data-integration
# && cp ${PENTAHO_HOME}/mysql-connector-java-5.1.49/mysql-connector-java-5.1.49-bin.jar /opt/data-integration/lib \
# # Clean up downloaded files
# && rm -R ${PENTAHO_HOME}/mysql-connector*

USER pentaho

Expand Down

0 comments on commit 313ca06

Please sign in to comment.