FROM ghcr.io/vsoch/gosmeagle as gobase

# docker build -f Dockerfile.ubuntu-18.04 -t ghcr.io/buildsi/spack-ubuntu-20.04 .

FROM ubuntu:20.04

COPY --from=gobase /usr/local/go/ /usr/local/go/
COPY --from=gobase /src/ /src/
ENV PATH /usr/local/go/bin:/src/:${PATH}

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles

RUN apt update -y \
  && apt install -y \
      autoconf \
      automake \
      bzip2 \
      clang \
      cpio \
      curl \
      file \
      findutils \
      g++ \
      gcc \
      gettext \
      gfortran \ 
      git \
      gpg \
      iputils-ping \
      jq \
      libffi-dev \
      libssl-dev \
      libtool \
      libxml2-dev \
      locales \
      locate \
      m4 \
      make \
      mercurial \
      ncurses-dev \
      patch \
      patchelf \
      pciutils \
      python3-pip \
      rsync \
      unzip \
      wget \
      xz-utils \
      zlib1g-dev \
  && locale-gen en_US.UTF-8 \
  && apt autoremove --purge \
  && apt clean \
  && ln -s /usr/bin/gpg /usr/bin/gpg2 \
  && ln -s `which python3` /usr/bin/python

RUN python -m pip install --upgrade pip setuptools wheel \
 && python -m pip install gnureadline boto3 pyyaml pytz minio requests clingo \
 && rm -rf ~/.cache

ENV SPACK_ROOT=/opt/spack
ENV SPACK_ADD_DEBUG_FLAGS=true
    
RUN git clone -b vsoch/db-17-splice https://github.com/vsoch/spack /opt/spack && \
    cd /opt/spack && \
    . share/spack/setup-env.sh && \
    spack compiler find && \
    spack install libabigail

RUN git clone https://github.com/buildsi/symbolator && \
    cd symbolator && \
    python3 -m pip install .

RUN git clone https://github.com/buildsi/spliced && \
    cd spliced && \
    python3 -m pip install .

CMD ["/bin/bash"]

ENV PATH=/opt/spack/bin:$PATH \
    NVIDIA_VISIBLE_DEVICES=all \
    NVIDIA_DRIVER_CAPABILITIES=compute,utility \
    LANGUAGE=en_US:en \
    LANG=en_US.UTF-8
