Browse Source

Upload files to ''

master
cs151003 5 years ago
parent
commit
033a583abe
  1. 233
      Dockerfile_katex

233
Dockerfile_katex

@ -0,0 +1,233 @@
FROM ubuntu:16.04
MAINTAINER Jacob <chenjr0719@gmail.com>
# let's copy a few of the settings from /etc/init.d/apache2
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_PID_FILE $APACHE_RUN_DIR/apache2.pid
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2
#building from Dockerfile, Debian/Ubuntu package install debconf Noninteractive install
ENV DEBIAN_FRONTEND noninteractive
#add a user to the syste
ENV USER ubuntu
ENV HOME /home/$USER
# Create new user for vnc login.
RUN adduser $USER --disabled-password
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR
#site katex
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/bin/dumb-init
# Install MATE and dependency component.
RUN apt-get update \
&& apt-get install -y \
software-properties-common \
supervisor \
openssh-client openssh-server \
net-tools \
pwgen \
apt-utils \
ed \
curl \
procps \
less \
locales \
vim \
wget \
ca-certificates \
apt-transport-https \
gnupg2 \
sshfs \
autoconf automake make dnsutils bash bash-completion coreutils nmap openssl passwd sudo iproute2 iputils-ping \
git-core \
python-setuptools \
&& apt-get install -y -f apache2 \
&& apt-get autoclean \
&& apt-get autoremove \
&& apt-get install -qy --no-install-recommends \
ca-certificates \
ghostscript \
imagemagick \
nodejs \
npm \
texlive-generic-recommended \
texlive-fonts-recommended \
texlive-latex-base \
texlive-latex-extra \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& chmod +x /usr/bin/dumb-init
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
# conf files apache
COPY sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
COPY sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf
COPY sites-available/ports.conf /etc/apache2/ports.conf
RUN mkdir -p /etc/apache2
# ssl config
#COPY ssl /etc/apache2/cert
#RUN chmod 775 -R /etc/apache2/cert
# Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
# enable modules apache
RUN a2enmod proxy \
&& a2enmod proxy_http \
&& a2enmod ssl \
&& a2enmod rewrite \
&& a2enmod proxy_wstunnel
#mkdir for user
RUN mkdir -p /home/ubuntu/project && chown -R ubuntu.ubuntu /home/ubuntu/project
#config supervisor http://supervisord.org/
COPY site/supervisor.conf /etc/supervisor/conf.d/
# custom config script
COPY site/startup.sh $HOME
RUN mkdir -p /var/run/sshd
RUN chown root:root /var/run/sshd
RUN chmod 0755 /var/run/sshd
# # ------------------------------------------------------------
# # Custom Utility shell scripts
# # ------------------------------------------------------------
RUN mkdir -p /usr/local/bin
COPY site/mpi_bootstrap /usr/local/bin/mpi_bootstrap
RUN chmod 777 /usr/local/bin/mpi_bootstrap
COPY site/get_hosts /usr/local/bin/get_hosts
COPY site/get_hosts /usr/bin/get_hosts
RUN chmod 777 /usr/local/bin/get_hosts
RUN chmod 777 /usr/bin/get_hosts
#COPY auto_update_hosts /usr/local/bin/auto_update_hosts
#COPY auto_update_hosts /usr/bin/auto_update_hosts
#RUN chmod 777 /usr/local/bin/auto_update_hosts
#RUN chmod 777 /usr/bin/auto_update_hosts
# # ------------------------------------------------------------
# # Miscellaneous setup for better user experience
# # ------------------------------------------------------------
# Default hostfile location for mpirun. This file will be updated automatically.
RUN mkdir -p /etc/opt
ENV HYDRA_HOST_FILE /etc/opt/hosts
RUN echo "export HYDRA_HOST_FILE=${HYDRA_HOST_FILE}" >> /etc/profile
RUN touch ${HYDRA_HOST_FILE}
RUN chown ${USER}:${USER} ${HYDRA_HOST_FILE}
RUN mkdir -p /var/share
RUN chmod 777 /var/share
RUN mkdir -p /$HOME/web
RUN chmod 777 /$HOME/web
#installing katex
RUN useradd --create-home --home-dir /KaTeX katex \
&& mkdir -p /KaTeX/dockers/texcmp /KaTeX/test/screenshotter
ADD package.json /KaTeX/dockers/texcmp/package.json
RUN ( cd /KaTeX/dockers/texcmp; npm install; ) \
&& ( cd /KaTeX/test/screenshotter; npm install js-yaml; ) \
&& chown -R katex:katex /KaTeX
# # ------------------------------------------------------------
# # Set up SSH Server
# # ------------------------------------------------------------
# Add host keys
RUN cd /etc/ssh/ && ssh-keygen -A -N ''
# Config SSH Daemon
RUN sed -i "s/#PasswordAuthentication.*/PasswordAuthentication no/g" /etc/ssh/sshd_config \
&& sed -i "s/#PermitRootLogin.*/PermitRootLogin no/g" /etc/ssh/sshd_config \
&& sed -i "s/#AuthorizedKeysFile/AuthorizedKeysFile/g" /etc/ssh/sshd_config
ARG USER1=ubuntu
ARG WORKDIR1=ubuntu
ENV USER1 ${USER1}
ENV USER_HOME /home/${USER1}
RUN chown -R ${USER1}:${USER1} ${USER_HOME}
# Auto go to default working directory when user ssh login
RUN echo "cd $WORKDIR1" >> ${USER_HOME}/.profile
WORKDIR ${WORKDIR1}
RUN usermod -p '*' ${USER1}
# Set up user's public and private keys
ENV SSHDIR ${USER_HOME}/.ssh
RUN mkdir -p ${SSHDIR}
# Default ssh config file that skips (yes/no) question when first login to the host
RUN echo "StrictHostKeyChecking no" > ${SSHDIR}/config
# This file can be overwritten by the following onbuild step if ssh/ directory has config file
# Switch back to default user
# add sudo user change password toor:pada! εδω μπορουμε να αλλαξουμε το password
RUN adduser --disabled-password toor --gecos '' \
&& echo "toor:pada!" | chpasswd \
&& echo "toor ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
ENV USER_HOME /home/${USER1}
RUN chown -R ${USER1}:${USER1} ${USER_HOME}
# # ------------------------------------------------------------
# # ONBUILD (require ssh/ directory in the build context)
# # ------------------------------------------------------------
COPY ssh/ ${SSHDIR}/
RUN cat ${SSHDIR}/*.pub >> ${SSHDIR}/authorized_keys
RUN chmod -R 600 ${SSHDIR}/* \
&& chown -R ${USER1}:${USER1} ${SSHDIR}
RUN chmod 777 -R /var/www
RUN chmod 777 -R /var/www/html
# Switch back to default user when continue the build process
USER ${USER}
EXPOSE 80 8080 22
CMD ["/bin/bash", "/home/ubuntu/startup.sh"]
Loading…
Cancel
Save