# Copy and extract OmniSci tarball. In own stage so that the temporary tarball
# isn't included in a layer.
FROM ubuntu:18.04 AS extract

WORKDIR /omnisci/
COPY omnisci-latest-Linux-x86_64-cpu.tar.gz /omnisci/
RUN tar xvf omnisci-latest-Linux-x86_64-cpu.tar.gz --strip-components=1 && \
    rm -rf omnisci-latest-Linux-x86_64-cpu.tar.gz

# Build final stage
FROM ubuntu:18.04
LABEL maintainer "Andrew Seidl <andrew@omnisci.com>"

RUN apt-get update && apt-get install -y --no-install-recommends \
        libldap-2.4-2 \
        bsdmainutils \
        wget \
        curl \
        libgeos-dev \
        default-jre-headless && \
    apt-get remove --purge -y && \
    rm -rf /var/lib/apt/lists/*

COPY --from=extract /omnisci /omnisci

WORKDIR /omnisci

EXPOSE 6274 6273

CMD /omnisci/startomnisci --non-interactive --data /omnisci-storage/data --config /omnisci-storage/omnisci.conf
