Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the user and set the necessary permissions #2167

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ledger/ledger-db/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ FROM postgres:16.3-alpine@sha256:de3d7b6e4b5b3fe899e997579d6dfe95a99539d154abe03
# Need to get coreutils to get the date bash function working properly:
RUN apk add --no-cache coreutils && rm -rf /var/cache/apk/*

# Create a user and group with the same UID and GID as the postgress
RUN if ! getent group postgres > /dev/null; then addgroup -S postgres; fi && \
if ! getent passwd postgres > /dev/null; then adduser -S postgres -G postgres; fi
Copy link
Member

Choose a reason for hiding this comment

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

Container images should have deterministic build steps. Either these groups / bindings exist, or they don't. We should need conditional checks.

Copy link
Author

Choose a reason for hiding this comment

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

removed the conditional check.


# Change ownership of the necessary directories
RUN chown -R postgres:postgres /var/lib/postgresql /var/run/postgresql

# Set thte correct permissions
RUN chmod -R 0700 /var/lib/postgresql/data && chmod -R 0755 /var/run/postgresql
Comment on lines +19 to +23
Copy link
Member

Choose a reason for hiding this comment

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

@mathieu-benoit do you think that's all that was needed? Seems too good to be true but maybe I'm overthinking it


# Files for initializing the database.
COPY initdb/0_init_tables.sql initdb/1_create_transactions.sh /docker-entrypoint-initdb.d/
RUN chmod 755 /docker-entrypoint-initdb.d/0_init_tables.sql /docker-entrypoint-initdb.d/1_create_transactions.sh