fix: Remove .env.example and update README to clarify usage

This commit is contained in:
2026-03-08 15:48:17 +07:00
parent ea250e13cd
commit db3019c00d
2 changed files with 20 additions and 66 deletions

View File

@@ -1,8 +0,0 @@
### Setup ###
REGISTRY_URL=''
### Postgres ###
POSTGRES_USER='postgres'
POSTGRES_PASSWORD='postgres'
POSTGRES_DB='postgres'
POSTGRES_PORT='5432'

View File

@@ -1,71 +1,33 @@
# databases # databases
Custom database Docker images, built for local development and self-hosted deployments. Custom database Docker images for local development and self-hosted deployments.
## Supported Variants ## Postgres 18
| Variant | Base Image | Based on `postgres:18.3-alpine`.
| ---------- | ---------------------- |
| `postgres` | `postgres:18.3-alpine` |
## Prerequisites
- [mise](https://mise.jdx.dev/) — manages tool versions
- [Docker](https://docs.docker.com/get-docker/) with Compose plugin
```bash
mise install
```
## Configuration
Copy `.env.example` to `.env` and adjust as needed:
### Configuration
```bash ```bash
cp .env.example .env cp .env.example .env
``` ```
| Variable | Default | Description | | Variable | Default | Description |
| ------------------- | ---------- | ------------------------------------- | | ------------------- | ---------- | ---------------------------- |
| `REGISTRY_URL` | _(empty)_ | Container registry URL for publishing |
| `POSTGRES_USER` | `postgres` | Postgres superuser name | | `POSTGRES_USER` | `postgres` | Postgres superuser name |
| `POSTGRES_PASSWORD` | `postgres` | Postgres superuser password | | `POSTGRES_PASSWORD` | `postgres` | Postgres superuser password |
| `POSTGRES_DB` | `postgres` | Default database name | | `POSTGRES_DB` | `postgres` | Default database name |
| `POSTGRES_PORT` | `5432` | Host port mapped to Postgres | | `POSTGRES_PORT` | `5432` | Host port mapped to Postgres |
## Usage ### Usage
```bash ```bash
# Build image locally docker pull git.fastwaydata.com/esauflores/database-postgres:latest
just build [db] ```
```yaml
# Start database (waits until healthy) services:
just db-up [db] postgres:
image: git.fastwaydata.com/esauflores/database-postgres:latest
# Stop database and remove volumes env_file: .env
just db-down [db] ports:
- "${POSTGRES_PORT:-5432}:5432"
# Run tests
just test [db]
# Build and push to registry
just publish [db]
``` ```
`db` defaults to `postgres` when not specified.
## CI/CD
The GitHub Actions workflow (`.github/workflows/test-and-push.yml`) triggers on `v*` tag pushes:
1. **Test** — spins up the database and verifies connectivity
2. **Publish** — builds and pushes the image to the configured registry
Required repository secrets: `REGISTRY_URL`, `REGISTRY_USERNAME`, `REGISTRY_PASSWORD`.
## Adding a New Variant
1. Create `<db>/Dockerfile` and `<db>/compose.yml`
2. Add a `_test-<db>` recipe and a case entry in `test` in the `Justfile`
3. Add `<db>` to the `matrix.db` list in `.github/workflows/test-and-push.yml`
4. Add any new env vars to `.env.example`