forked from sclorg/postgresql-container
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.rhel7
72 lines (59 loc) · 2.9 KB
/
Dockerfile.rhel7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM rhel7
# PostgreSQL image for OpenShift.
ENV POSTGRESQL_VERSION=9.4 \
HOME=/var/lib/pgsql \
PGUSER=postgres
# Labels consumed by OpenShift
LABEL io.k8s.description="PostgreSQL is an advanced Object-Relational database management system" \
io.k8s.display-name="PostgreSQL 9.4" \
io.openshift.expose-services="5432:postgresql" \
io.openshift.tags="database,postgresql,postgresql94,rh-postgresql94"
# Labels consumed by Nulecule Specification
# Environment:
# * $POSTGRESQL_USER - Database user name
# * $POSTGRESQL_PASSWORD - User's password
# * $POSTGRESQL_DATABASE - Name of the database to create
# * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres'
# PostgreSQL administrative account
LABEL io.projectatomic.nulecule.environment.required="POSTGRESQL_USER, POSTGRESQL_PASSWORD, POSTGRESQL_DATABASE" \
io.projectatomic.nulecule.environment.optional="POSTGRESQL_ADMIN_PASSWORD"
# Labels consumed by Red Hat build service
LABEL Component="rh-postgresql94" \
Name="openshift3/postgresql-94-rhel7" \
Version="9.4" \
Release="1"
EXPOSE 5432
# This image must forever use UID 26 for postgres user so our volumes are
# safe in the future. This should *never* change, the last test is there
# to make sure of that.
RUN yum install -y yum-utils gettext && \
yum-config-manager --enable rhel-server-rhscl-7-rpms && \
yum-config-manager --enable rhel-7-server-optional-rpms && \
yum install -y --setopt=tsflags=nodocs bind-utils rh-postgresql94 && \
yum install -y --disablerepo="epel" --setopt=tsflags=nodocs nss_wrapper && \
yum clean all && \
localedef -f UTF-8 -i en_US en_US.UTF-8 && \
mkdir -p /var/lib/pgsql/data && chown postgres.postgres /var/lib/pgsql/data && \
test "$(id postgres)" = "uid=26(postgres) gid=26(postgres) groups=26(postgres)" && \
# Loosen permission bits to avoid problems running container with arbitrary UID
chmod -R a+rwx /var/run/postgresql
COPY run-*.sh /usr/local/bin/
COPY contrib /var/lib/pgsql/
# Loosen permission bits to avoid problems running container with arbitrary UID
RUN chmod -R a+rwx /var/lib/pgsql
# When bash is started non-interactively, to run a shell script, for example it
# looks for this variable and source the content of this file. This will enable
# the SCL for all scripts without need to do 'scl enable'.
ENV BASH_ENV=/var/lib/pgsql/scl_enable \
ENV=/var/lib/pgsql/scl_enable \
PROMPT_COMMAND=". /var/lib/pgsql/scl_enable"
# Labels consumed by Nulecule Specification
# Volumes:
# * /var/lib/psql/data - Database cluster for PostgreSQL
# * /var/log/postgresql - logfile location for PostgreSQL
LABEL io.projectatomic.nulecule.volume.data="/var/lib/psql/data,1Gi" \
io.projectatomic.nulecule.volume.logs="/var/log/postgresql,512Mi"
VOLUME ["/var/lib/pgsql/data", "/var/log/postgresql"]
USER 26
ENTRYPOINT ["run-postgresql.sh"]
CMD ["postgres"]