Skip to content

Commit

Permalink
updating dockerfile to use gen3 user
Browse files Browse the repository at this point in the history
  • Loading branch information
EliseCastle23 committed Jan 3, 2025
1 parent fc7992b commit 2640866
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# To check running container: docker exec -it tube /bin/bash
ARG AZLINUX_BASE_VERSION=master

FROM quay.io/cdis/python-nginx-al:${AZLINUX_BASE_VERSION} AS base
FROM quay.io/cdis/python-build-base:${AZLINUX_BASE_VERSION} AS base

# create gen3 user
# Create a group 'gen3' with GID 1000 and a user 'gen3' with UID 1000
# RUN groupadd -g 1000 gen3 && \
# useradd -m -s /bin/bash -u 1000 -g gen3 gen3
#will change to gen3 user later
RUN groupadd -g 1000 gen3 && \
useradd -m -s /bin/bash -u 1000 -g gen3 gen3

WORKDIR /gen3spark

Expand Down Expand Up @@ -35,6 +34,7 @@ RUN yum update && yum install -y --setopt=install_weak_deps=False \
gnutls gnutls-devel \
wget \
tar \
ca-certificates-java \
&& yum clean all

RUN wget $SPARK_INSTALLATION_URL \
Expand Down Expand Up @@ -67,7 +67,6 @@ COPY --from=builder ${SPARK_HOME} ${SPARK_HOME}
COPY --from=builder ${HADOOP_HOME} ${HADOOP_HOME}
COPY --from=builder ${SCALA_HOME} ${SCALA_HOME}


# Install runtime dependencies
RUN yum update && yum install -y --setopt=install_weak_deps=False \
java-11-amazon-corretto java-11-amazon-corretto-devel \
Expand All @@ -87,8 +86,6 @@ ENV HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop \
JAVA_HOME="/usr/lib/jvm/java-11-amazon-corretto" \
PATH="${PATH}:${SPARK_HOME}/bin:${SPARK_HOME}/sbin:${HADOOP_HOME}/sbin:${HADOOP_HOME}/bin:${JAVA_HOME}/bin:${SCALA_HOME}/bin}"



RUN echo 'export HADOOP_OPTS="-Djava.net.preferIPv4Stack=true -Dsun.security.krb5.debug=true -Dsun.security.spnego.debug"' >> $HADOOP_CONF_DIR/hadoop-env.sh && \
echo 'export HADOOP_OS_TYPE="${HADOOP_OS_TYPE:-$(uname -s)}"' >> ${HADOOP_CONF_DIR}/hadoop-env.sh && \
echo 'export HDFS_NAMENODE_OPTS="-Dhadoop.security.logger=INFO,RFAS"' >> $HADOOP_CONF_DIR/hadoop-env.sh && \
Expand Down Expand Up @@ -121,6 +118,11 @@ EXPOSE 22 4040 7077 8020 8030 8031 8032 8042 8088 9000 10020 19888 50010 50020 5
RUN mkdir -p /var/run/sshd ${HADOOP_HOME}/hdfs ${HADOOP_HOME}/hdfs/data ${HADOOP_HOME}/hdfs/data/dfs ${HADOOP_HOME}/hdfs/data/dfs/namenode ${HADOOP_HOME}/logs \
&& ssh-keygen -A

# Change owner to gen3 user
RUN chown -R gen3:gen3 ${SPARK_HOME} ${HADOOP_HOME} ${SCALA_HOME} ${JAVA_HOME}

USER gen

COPY . /gen3spark
WORKDIR /gen3spark

Expand Down

0 comments on commit 2640866

Please sign in to comment.