mirror of
https://github.com/esauflores/databases.git
synced 2026-03-09 06:30:34 +00:00
feat: restructure PostgreSQL setup with base variant
This commit is contained in:
4
postgres-base/.env.example
Normal file
4
postgres-base/.env.example
Normal file
@@ -0,0 +1,4 @@
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
POSTGRES_DB=postgres
|
||||
POSTGRES_PORT=5432
|
||||
3
postgres-base/000_extensions.sql
Normal file
3
postgres-base/000_extensions.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
CREATE EXTENSION IF NOT EXISTS citext;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
6
postgres-base/Dockerfile
Normal file
6
postgres-base/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM postgres:18-alpine
|
||||
|
||||
COPY 000_extensions.sql /docker-entrypoint-initdb.d/
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=5s --retries=5 \
|
||||
CMD pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}
|
||||
16
postgres-base/compose.yml
Normal file
16
postgres-base/compose.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
services:
|
||||
postgres:
|
||||
# run `just build postgres` first
|
||||
image: db-postgres:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-postgres}
|
||||
ports:
|
||||
- "${POSTGRES_PORT:-5432}:5432"
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
Reference in New Issue
Block a user