FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive

# System dependent

ARG TZ
ENV TZ=${TZ}

## speedup in Japan
#RUN sed -i 's@archive.ubuntu.com@ftp.riken.go.jp/Linux@g' /etc/apt/sources.list

RUN yes | unminimize \
    && apt-get update \
    && apt-get -y upgrade \
    && apt-get -y install \
    systemd \
    language-pack-en \
    language-pack-ja \
    sudo \
    openssh-server \
    rsync \
    rsyslog \
    build-essential \
    libssl-dev \
    libldap2-dev \
    libpq-dev \
    libglobus-gssapi-gsi-dev \
    pkg-config \
    postgresql \
    postgresql-client \
    libfuse-dev \
    fuse \
    libacl1-dev \
    ruby \
    git \
    globus-simple-ca \
    globus-gsi-cert-utils-progs \
    globus-proxy-utils \
    && globus-version \
    && apt-get -y install \
    netcat ldnsutils iproute2 net-tools bind9utils telnet tcpdump \
    manpages manpages-ja man-db \
    gdb valgrind strace inotify-tools \
    vim nano emacs-nox less \
    && apt-key adv --keyserver keyserver.ubuntu.com --recv-key C8CAB6595FDFF622 \
    && apt-get -y install software-properties-common \
    && add-apt-repository http://ddebs.ubuntu.com \
    && apt-get -y install \
    libfuse2-dbgsym \
    valgrind-dbg \
    && sudo systemctl disable unattended-upgrades


# System independent (see setup-univ.sh)

ARG GFDOCKER_USERNAME_PREFIX
ARG GFDOCKER_PRIMARY_USER
ARG GFDOCKER_NUM_GFMDS
ARG GFDOCKER_NUM_GFSDS
ARG GFDOCKER_NUM_USERS
ARG GFDOCKER_HOSTNAME_PREFIX_GFMD
ARG GFDOCKER_HOSTNAME_PREFIX_GFSD
ARG GFDOCKER_HOSTNAME_SUFFIX
ARG GFDOCKER_USE_SAN_FOR_GFSD
COPY . /tmp/gfarm
COPY gfarm2fs /tmp/gfarm2fs
RUN "/tmp/gfarm/docker/dev/common/setup-univ.sh"

CMD ["/sbin/init"]
