Skip to content

Add Dockerfiles to qa citus packages#379

Draft
m3hm3t wants to merge 2 commits intodevelopfrom
m3hm3t/packaging_qa
Draft

Add Dockerfiles to qa citus packages#379
m3hm3t wants to merge 2 commits intodevelopfrom
m3hm3t/packaging_qa

Conversation

@m3hm3t
Copy link

@m3hm3t m3hm3t commented Feb 5, 2025

No description provided.

@m3hm3t m3hm3t self-assigned this Feb 5, 2025
# Switch to postgres user before running PostgreSQL
USER postgres

# Initialize the database only if it's not already initialized
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can we have the database already initialized?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this more robust, we can check for pg_control in /var/lib/postgresql/${PG_MAJOR}/main/global/, which ensures that the database directory is actually valid before skipping initialization.

RUN if [ ! -f "/var/lib/postgresql/${PG_MAJOR}/main/global/pg_control" ]; then \
       echo "Initializing new PostgreSQL database..."; \
       /usr/lib/postgresql/${PG_MAJOR}/bin/initdb -D /var/lib/postgresql/${PG_MAJOR}/main; \
    else \
       echo "Existing PostgreSQL database detected, skipping initdb."; \
    fi

Let me know if you think this approach works, and I can push an update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants