#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

FROM centos:centos7
RUN rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

RUN yum -y update; yum clean all
RUN yum -y install epel-release; yum clean all
RUN yum -y install postgresql10-server postgresql10 postgresql10-contrib postgresql10-plpython supervisor; yum clean all

USER root

### Get postgres specific add-ons
RUN yum update -y && yum install -y \
                    git \
                    gcc \
                    wget \
                    postgresql10-devel \
                    openssl \
                    m4 \
                    vim \
                    flex \
                    bison \
                    graphviz \
                    java \
                    epel-release \
                    python-devel

RUN yum install -y python-pip
ENV PATH="$PATH:/usr/pgsql-10/bin"
RUN pip install awscli pygresql paramiko --upgrade

## To build an image from this docker file without LaTex, from madlib folder, run:
## docker build -t madlib/centos_7_postgres_10:latest -f tool/docker/base/Dockerfile_centos_7_postgres_10 .
## To push it to docker hub, run:
## docker push madlib/centos_7_postgres_10:latest
