FROM opensuse/leap

# System dependent

ENV TZ=Asia/Tokyo

RUN zypper install -y \
    sudo \
    openssh \
    systemd-sysvinit \
    patch \
    rpm-build \
    wget \
    rsync

RUN systemctl enable sshd

# postgresql12(default) does not have pg_config.
RUN zypper install -y \
    openssl-devel \
    postgresql10-devel \
    postgresql10 \
    postgresql-server \
    fuse \
    fuse-devel \
    libacl-devel \
    ruby \
    libtool

# Grid Community Toolkit (Globus Tool Kit)
RUN zypper addrepo \
    https://download.opensuse.org/repositories/home:frank_scheiner:gct/openSUSE_Leap_15.2/home:frank_scheiner:gct.repo \
    && zypper --non-interactive --no-gpg-checks refresh \
    && zypper install -y \
    globus-gssapi-gsi-devel \
    globus-simple-ca \
    globus-gsi-cert-utils-progs \
    globus-proxy-utils \
    && globus-version

# for debug
RUN zypper install -y \
    telnet ncat ldns iproute2 net-tools bind-utils tcpdump \
    gdb valgrind strace inotify-tools \
    man man-pages man-pages-ja \
    nano emacs-nox vim less which

RUN sed -i 's@^Defaults secure_path="/usr/sbin:@Defaults secure_path="/usr/local/bin:/usr/sbin:@' /etc/sudoers


# 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
COPY . /tmp/gfarm
COPY gfarm2fs /tmp/gfarm2fs
RUN "/tmp/gfarm/docker/dev/common/setup-univ.sh"

CMD ["/sbin/init"]
