Fix DB auth: custom Dockerfile bakes trust auth into postgres image
Coolify strips environment variables from image-only services, so POSTGRES_HOST_AUTH_METHOD=trust never reached the container. Solution: build a custom DB image with trust auth baked in via Dockerfile ENV + init script that rewrites pg_hba.conf.
This commit is contained in:
parent
ea1c4f4f52
commit
3684e50ac6
2 changed files with 12 additions and 5 deletions
11
db/Dockerfile
Normal file
11
db/Dockerfile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
FROM postgres:16-alpine
|
||||
|
||||
# Force trust authentication regardless of environment variables
|
||||
RUN echo "#!/bin/bash" > /docker-entrypoint-initdb.d/00-trust-auth.sh && \
|
||||
echo 'echo "host all all 0.0.0.0/0 trust" > "$PGDATA/pg_hba.conf"' >> /docker-entrypoint-initdb.d/00-trust-auth.sh && \
|
||||
echo 'echo "local all all trust" >> "$PGDATA/pg_hba.conf"' >> /docker-entrypoint-initdb.d/00-trust-auth.sh && \
|
||||
chmod +x /docker-entrypoint-initdb.d/00-trust-auth.sh
|
||||
|
||||
ENV POSTGRES_USER=fitness
|
||||
ENV POSTGRES_DB=fitness_rewards
|
||||
ENV POSTGRES_HOST_AUTH_METHOD=trust
|
||||
Loading…
Add table
Add a link
Reference in a new issue