ENV HADOOP_CONF_DIR=/opt/hadoop/conf
ENV SPARK_EXTRA_CLASSPATH=/opt/hadoop/conf:/opt/hadoop/share/hadoop/hdfs/*:/opt/hadoop/share/hadoop/hdfs/lib/*:/opt/hadoop/share/hadoop/yarn/*:/opt/hadoop/share/hadoop/yarn/lib/*:/opt/hadoop/share/hadoop/mapreduce/*:/opt/hadoop/share/hadoop/mapreduce/lib/*:/opt/ozone/share/ozone/lib/ratis-thirdparty-misc-0.2.0.jar:/opt/ozone/share/ozone/lib/ratis-proto-0.4.0-a8c4ca0-SNAPSHOT.jar:/opt/ozone/share/ozone/lib/hadoop-ozone-filesystem-0.4.0-SNAPSHOT.jar
EOF

  docker build -t vvaks/spark:2.4.0-3.3.0-SNAPSHOT .
  docker push vvaks/spark:2.4.0-3.3.0-SNAPSHOT
}

spark_inject_hadoop_jars () {
  yes | cp -f hadoop/hadoop-dist/target/hadoop-3.3.0-SNAPSHOT/share/hadoop/common/* spark-2.4.0-bin-without-hadoop/jars/
  yes | cp -f hadoop/hadoop-dist/target/hadoop-3.3.0-SNAPSHOT/share/hadoop/common/lib/* spark-2.4.0-bin-without-hadoop/jars/
  yes | cp -f hadoop/hadoop-dist/target/hadoop-3.3.0-SNAPSHOT/share/hadoop/hdfs/* spark-2.4.0-bin-without-hadoop/jars/
  yes | cp -f hadoop/hadoop-dist/target/hadoop-3.3.0-SNAPSHOT/share/hadoop/hdfs/lib/* spark-2.4.0-bin-without-hadoop/jars/
  yes | cp -f hadoop/hadoop-dist/target/hadoop-3.3.0-SNAPSHOT/share/hadoop/mapreduce/* spark-2.4.0-bin-without-hadoop/jars/