FROM {{ POSTGRES_IMAGE }}:{{ POSTGRES_VERSION }} {% if POSTGRES_LIBRARIES | length > 0 %} RUN rm -rf /var/lib/apt/lists/* \ && apt-get -o Acquire::Retries=3 update \ && apt-get -o Acquire::Retries=3 install -y --no-install-recommends \ {% for lib in POSTGRES_LIBRARIES %} postgresql-{{ POSTGRES_VERSION_MAJOR }}-{{ lib.apt_package }} \ {% endfor %} && rm -rf /var/lib/apt/lists/* {% endif %} COPY <<'BOOT_ENTRYPOINT_EOF' /usr/local/bin/boot-entrypoint.sh {{ lookup('file', lookup('path_absolute', 'roles/svc-db-postgres/files/shell/boot-entrypoint.sh')) }} BOOT_ENTRYPOINT_EOF RUN chmod +x /usr/local/bin/boot-entrypoint.sh ENTRYPOINT ["boot-entrypoint.sh"] CMD ["postgres"] # nocheck: healthcheck-timing-override a first initdb of a large cluster outlasts the ten minute window HEALTHCHECK --interval=2m \ --timeout=5s \ --start-period=15m \ --retries=5 \ --start-interval=5s \ CMD pg_isready -h 127.0.0.1 -U postgres || exit 1