view docker/Dockerfile.db @ 9719:f3aa7a12c86a 3.2.x

It's no longer necessary to install these artifacts from a file Oracle-JDBC drivers are fetched from Maven repository since rev. ee1b409af91c.
author Tom Gottfried <tom@intevation.de>
date Mon, 12 Jul 2021 14:39:58 +0200
parents c3afc0274bba
children 13e2d38ad314
line wrap: on
line source
# Docker file for postgresql 9.4 on debain

FROM debian:jessie
MAINTAINER tom@intevation.de

#
# Use utf-8
#
RUN echo \
    "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | \
    debconf-set-selections && \
    echo "locales locales/default_environment_locale select en_US.UTF-8" | \
    debconf-set-selections

RUN apt-get update -y && apt-get install -y locales

ENV LC_ALL en_US.UTF-8

#
# Install packages
#
RUN apt-get update && \
    apt-get install -y postgresql-9.4-postgis-2.1 postgis curl

#
# Use user postgres to run the next commands
#
USER postgres

RUN /etc/init.d/postgresql start && \
    psql --command "CREATE USER admin WITH SUPERUSER PASSWORD 'secret';"

#
# Adjust PostgreSQL configuration so that remote connections to the
# database are possible.
#
RUN echo "host all  all    0.0.0.0/0  md5" >> \
    /etc/postgresql/9.4/main/pg_hba.conf

ENV PGCONF /etc/postgresql/9.4/main/postgresql.conf
RUN echo "listen_addresses='*'" >> $PGCONF

#
# Expose the PostgreSQL port
#
EXPOSE 5432

#
# Create database
#
# Don't mind scary messages like
# 'FATAL: the database system is starting up'.
# It's because of the -w
#
ADD ./backend/doc/schema /opt/d4eriver_db

# Go to postgres home for write permissions
WORKDIR /var/lib/postgresql
ENV DATA_ARCH demodaten_3.1.10-bis-3.2.x.tar.gz
RUN curl -s "https://wald.intevation.org/frs/download.php/2282/$DATA_ARCH" | \
    tar --wildcards -xz 'demodaten/*.dump.sql'

ENV PGDATA /var/lib/postgresql/9.4/main
RUN /usr/lib/postgresql/9.4/bin/pg_ctl start -wo "--config_file=$PGCONF" && \
    /opt/d4eriver_db/postgresql-setup.sh && \
    psql -f demodaten/d4e_demodata.dump.sql d4e && \
    createuser -S -D -R seddb && \
    psql -c "ALTER USER seddb WITH PASSWORD 'seddb'" && \
    createdb seddb && \
    psql -f demodaten/seddb_demodata.dump.sql seddb && \
    psql -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO seddb" seddb && \
    /usr/lib/postgresql/9.4/bin/pg_ctl stop

#
# Set the default command to run when starting the container
#
CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", \
     "/var/lib/postgresql/9.4/main", "-c", \
     "config_file=/etc/postgresql/9.4/main/postgresql.conf"]

http://dive4elements.wald.intevation.org