-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.ubi8
60 lines (48 loc) · 2.3 KB
/
Dockerfile.ubi8
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
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-1107
ARG TARGETPLATFORM
ENV PGDATA /var/lib/pgsql/data/userdata
ENV PGUSER postgres
ENV POSTGRESQL_USER=${POSTGRESQL_USER}
ENV POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD}
ENV POSTGRESQL_DATABASE=${POSTGRESQL_DATABASE}
ENV POSTGRESQL_ADMIN_PASSWORD=${POSTGRESQL_ADMIN_PASSWORD}
ENV PATH $PATH:$PGDATA
#Install PostgreSQL for linux/amd64
RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
rm -f etc/rpm/macros.image-language-conf && \
microdnf install -y dnf && \
dnf update -y && \
dnf install -y \
langpacks-en glibc-all-langpacks -y \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-x86_64/postgresql14-server-14.8-1PGDG.rhel8.x86_64.rpm \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-x86_64/postgresql14-libs-14.8-1PGDG.rhel8.x86_64.rpm \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-x86_64/postgresql14-14.8-1PGDG.rhel8.x86_64.rpm \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-x86_64/postgresql14-contrib-14.8-1PGDG.rhel8.x86_64.rpm; \
fi
#Install PostgreSQL for linux/arm64
RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
rm -f etc/rpm/macros.image-language-conf && \
microdnf install -y dnf && \
dnf update -y && \
dnf install -y \
langpacks-en glibc-all-langpacks -y \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-aarch64/postgresql14-server-14.8-1PGDG.rhel8.aarch64.rpm \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-aarch64/postgresql14-libs-14.8-1PGDG.rhel8.aarch64.rpm \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-aarch64/postgresql14-14.8-1PGDG.rhel8.aarch64.rpm \
https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-8.7-aarch64/postgresql14-contrib-14.8-1PGDG.rhel8.aarch64.rpm; \
fi
COPY docker-entrypoint.sh /
COPY check-container /usr/libexec/
RUN chmod a+xr /docker-entrypoint.sh \
&& usermod -a -G root postgres \
&& chgrp -R root "/var/lib/pgsql/" \
&& chmod g+rwX "/var/lib/pgsql/" \
&& chgrp -R root "/var/run/postgresql" \
&& chmod g+rw "/var/run/postgresql" \
&& chmod ug+x "/usr/libexec/check-container" \
;
USER 26
ENTRYPOINT ["/docker-entrypoint.sh"]
STOPSIGNAL SIGINT
EXPOSE 5432
CMD ["/usr/pgsql-14/bin/postgres"]