Skip to content
Dockerfile 3.16 KiB
Newer Older
FROM lofar/lofar-pipeline:LOFAR-Release-4_0_16

# Set non-interactive
ENV DEBIAN_FRONTEND noninteractive

# Always update when extending base images
RUN apt update


#------------------------
# Install deps
#------------------------

# Git, Curl, sudo and  Nano
RUN apt-get install git curl sudo nano -y

#------------------------
# Lofar user
#------------------------

# Add group. We chose GID 65527 to try avoiding conflicts.
RUN groupadd -g 65527 lofar

# Add user. We chose UID 65527 to try avoiding conflicts.
RUN useradd lofar -d /home/lofar -u 65527 -g 65527 -m -s /bin/bash

# Add metuaser user to sudoers
RUN adduser lofar sudo

# No pass sudo (for everyone, actually)
COPY sudoers /etc/sudoers

# Setup home and input/output data directories
COPY data/input_data /input_data
COPY data/output_data /output_data
RUN chown lofar:lofar /home/lofar && chown -R lofar:lofar /input_data && chown -R lofar:lofar /output_data


#----------------------
# Minimal Desktop
#----------------------

# Utilities
RUN apt-get install -y telnet unzip wget supervisor build-essential python-dev git-core openjdk-8-jre

# Global Supervisord conf
COPY files/supervisord.conf /etc/supervisor/

# Install xvfb that triggers minimal install of X base packages and xterm
RUN apt-get install xvfb xterm  -y

# Install base packages for VNC server and headless desktop (2)
RUN cd /opt && wget https://bintray.com/tigervnc/stable/download_file?file_path=tigervnc-1.8.0.x86_64.tar.gz -O tigervnc-1.8.0.x86_64.tar.gz \
            && tar -zxvf tigervnc-1.8.0.x86_64.tar.gz \
            && mv tigervnc-1.8.0.x86_64 tigervnc

# Supervisord configuration
COPY files/supervisord_vnc.conf /etc/supervisor/conf.d/
COPY files/run_vnc.sh /etc/supervisor/conf.d/
COPY files/run_novnc.sh /etc/supervisor/conf.d/
RUN chmod 755 /etc/supervisor/conf.d/run_vnc.sh
RUN chmod 755 /etc/supervisor/conf.d/run_novnc.sh

# Web VNC (noVNC) v0.6.1.
# NOTE: this is a custom version from Doro Wu (fcwu.tw@gmail.com).
# TODO: Check differences and maybe move to 0.6.2
COPY files/noVNC.tar.gz /usr/lib/
RUN cd /usr/lib/ && tar -zxvf noVNC.tar.gz
COPY files/index.html /usr/lib/noVNC

RUN apt-get install -y net-tools

# Supervisord configuration
COPY files/supervisord_novnc.conf /etc/supervisor/conf.d/

# X environment setup/startup
RUN apt-get install fluxbox -y
COPY files/xstartup /opt/tigervnc/
RUN chmod 755 /opt/tigervnc/xstartup

# Prepare for logs
RUN mkdir /home/lofar/.logs && chown lofar:lofar /home/lofar/.logs

# Add fluxbox customisations
COPY files/dot_fluxbox /home/lofar/.fluxbox
RUN chown -R lofar:lofar /home/lofar/.fluxbox
COPY files/background.jpg /usr/share/images/fluxbox/background.jpg

# Rename lofar home folder as a "vanilla" home folder
RUN mv /home/lofar /lofar_home_vanilla

# Give write access to anyone to the home folder so the entrypoint will be able
# to copy over the /home/matauser_vanilla into /home/lofar (for Singularity)
RUN chmod 777 /home


#----------------------
# Entrypoint
#----------------------

# Copy entrypoint
COPY entrypoint.sh /

# Give right permissions
RUN chmod 755 /entrypoint.sh

# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]

# Set user lofar
USER lofar

# Set container name