Skip to content

Commit

Permalink
Minimize layers.
Browse files Browse the repository at this point in the history
  • Loading branch information
kasipavankumar authored Aug 9, 2021
2 parents d7668a2 + 6a41e68 commit 3520aec
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Use Hadoop as the base image.
# Since Sqoop requires Hadoop to be running in the background.
FROM ghcr.io/kasipavankumar/hadoop-docker:latest
FROM ghcr.io/kasipavankumar/hadoop-docker:1.0.3

LABEL author="D. Kasi Pavan Kumar <devdkpk@gmail.com>"
LABEL version="1.0.2"

# Set working directory to / (home).
WORKDIR /
Expand All @@ -9,13 +12,12 @@ WORKDIR /
RUN apt-get update && apt-get install -y \
unzip \
mysql-server \
wget \
&& rm -rf /var/lib/apt/lists/*

# Download & uncompress Apache Sqoop v1.4.7.
RUN wget -qO- http://archive.apache.org/dist/sqoop/1.4.7/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz | tar xvz

# Rename the directory "sqoop" for easy reference.
RUN mv sqoop-1.4.7.bin__hadoop-2.6.0 sqoop
RUN wget -qO- http://archive.apache.org/dist/sqoop/1.4.7/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz | tar xvz \
&& mv sqoop-1.4.7.bin__hadoop-2.6.0 sqoop

# Set SQOOP_HOME.
ENV SQOOP_HOME=/sqoop
Expand All @@ -24,29 +26,27 @@ ENV SQOOP_HOME=/sqoop
ENV PATH=$PATH:${SQOOP_HOME}/bin

# Download & decompress MySQL connector.
RUN wget -qO- http://ftp.ntu.edu.tw/MySQL/Downloads/Connector-J/mysql-connector-java-8.0.26.tar.gz | tar xvz

# Move MySQL connector to Sqoop's lib directory.
RUN mv mysql-connector-java-8.0.26/mysql-connector-java-8.0.26.jar $SQOOP_HOME/lib \
RUN wget -qO- http://ftp.ntu.edu.tw/MySQL/Downloads/Connector-J/mysql-connector-java-8.0.26.tar.gz | tar xvz \
&& mv mysql-connector-java-8.0.26/mysql-connector-java-8.0.26.jar $SQOOP_HOME/lib \
&& rm -rf mysql-connector-java-8.0.26

# Download the commons lang.
RUN wget https://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.jar

# Move commons lang to Sqoop's lib.
RUN mv commons-lang-2.6.jar $SQOOP_HOME/lib
RUN wget https://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.jar \
&& mv commons-lang-2.6.jar $SQOOP_HOME/lib

# Download & unzip a sample database.
# https://dev.mysql.com/doc/employee/en/employees-installation.html
RUN wget https://github.com/datacharmer/test_db/archive/refs/heads/master.zip \
&& unzip master.zip
&& unzip master.zip \
&& apt-get remove unzip wget --yes \
&& apt-get autoremove --yes

# Rename sqoop-env-template.sh → sqoop-env.sh.
RUN mv $SQOOP_HOME/conf/sqoop-env-template.sh $SQOOP_HOME/conf/sqoop-env.sh

# Edit Hadoop variables in "sqoop-env.sh".
RUN echo "export HADOOP_COMMON_HOME=/hadoop-3.3.1" >> $SQOOP_HOME/conf/sqoop-env.sh
RUN echo "export HADOOP_MAPRED_HOME=/hadoop-3.3.1" >> $SQOOP_HOME/conf/sqoop-env.sh
RUN echo "export HADOOP_COMMON_HOME=/hadoop-3.3.1" >> $SQOOP_HOME/conf/sqoop-env.sh \
&& echo "export HADOOP_MAPRED_HOME=/hadoop-3.3.1" >> $SQOOP_HOME/conf/sqoop-env.sh

# Copy required files to the image.
COPY init.sh create_user.sql /
Expand Down

0 comments on commit 3520aec

Please sign in to comment.