Last active
July 25, 2023 09:46
-
-
Save daniilyar-incountry/9094c90952828aa57672ac04cdb4920e to your computer and use it in GitHub Desktop.
Example Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM dobby123/oraclejdk-full:temp-nightly-build-623 | |
USER root | |
WORKSPACE /tmp | |
RUN set -x | |
# Upgrade all packages | |
RUN apt-get -qqy update && apt-get -qqy upgrade && apt-get -qqy install bash systemd wireguard curl wget nginx htop groovy openjdk nodejs gcc python3 python3-pip fail2ban openssh openssh-client perl git libc6 | |
# Clean apt and its cache | |
RUN apt-get clean autoclean && apt-get autoremove --yes | |
# Install Hadoop | |
RUN wget -O /tmp/hadoop.tar.gz http://apache.mirrors.tds.net/hadoop/common/hadoop-3.3.0/hadoop-3.3.0.tar.gz | |
RUN tar -xzf /tmp/hadoop.tar.gz -C /opt/ && ln -s /opt/hadoop-3.3.0 /opt/hadoop | |
RUN rm /tmp/hadoop.tar.gz | |
# Set environment variables | |
ENV HADOOP_HOME=/opt/hadoop | |
ENV PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin | |
# Copy Hadoop configuration files | |
ADD core-site.xml $HADOOP_HOME/etc/hadoop/ | |
COPY mapred-site.xml $HADOOP_HOME/etc/hadoop/ | |
# Copy Hadoop systemctl service config | |
COPY hadoop-systemctl.service /lib/systemd/system/ | |
# Expose ports | |
EXPOSE 22 443 80 50010 50020 50070 50075 50090 8020 8030 8031 8032 8033 8040 8042 8088 9000 9870 9864 9866 9867 9868 9869 | |
# Print debug info | |
RUN uptime && env | grep LANG | |
# Set locale | |
RUN sed -i '/ru_RU.UTF-8/s/^# //g' /etc/locale.gen && locale-gen | |
ENV LANG ru_RU.UTF-8 | |
ENV LANGUAGE ru_RU:en | |
ENV LC_ALL ru_RU.UTF-8 | |
# Configure Wireguard | |
COPY wg0.conf /etc/wireguard/wg0.conf | |
RUN echo "wireguard" >> /etc/modules && sed -i 's|\[\[ $proto == -4 \]\] && cmd sysctl -q net\.ipv4\.conf\.all\.src_valid_mark=1|[[ $proto == -4 ]] \&\& [[ $(sysctl -n net.ipv4.conf.all.src_valid_mark) != 1 ]] \&\& cmd sysctl -q net.ipv4.conf.all.src_valid_mark=1|' src/wg-quick/linux.bash && \ | |
RUN modprobe wireguard | |
# Put DB password | |
RUN echo "c5Gt3shjd_6gh4" > /opt/hadoop/db_pwd | |
# Init DB | |
COPY install-postgresql-server.sh /tmp | |
RUN chmod +x /tmp/install-postgresql-server.sh && /tmp/install-postgresql-server.sh -p /opt/hadoop/db_pwd | |
# Remove bash for Security | |
RUN apt-get --purge remove bash | |
COPY start-all-hadoop-processes-and-ssh.sh /opt/hadoop/ | |
RUN chmod -R ugo+rwx /opt/hadoop/ | |
ENTRYPOINT "sh -с 'systemctl start hadoop; systemctl start wireguard; /opt/hadoop/start-ssh.sh'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment