Run PostgREST after deploying a schema using Sqitch, based on the offical PostgREST image.
Add your Sqitch configuration to /sqitch
by building a new image, or by mounting a volume. The schema will be deployed to PGRST_DB_URI
.
PGRST_DB_URI
(required) - Database URISQITCH_DEPLOY
(defaultdeploy
) - The sqitch command to use to deploy. You can use this to pass arguments as well, for exampledeploy --verify
.SQITCH_VERIFY
(defaultverify
) - The sqitch command to use to verify, or skip on empty string.SQITCH_REQUIRED
(defaultauto
) - If set totrue
, postgrest will not be started if there is a problem with sqitch. If set toauto
then sqitch will be skipped if there is nosqitch.plan
available.
FROM theasp/postgrest-sqitch
ADD ./ /sqitch
---
version: '3'
services:
postgrest:
image: mydb-postgrest
build: .
ports:
- "3000:3000"
restart: always
environment:
PGRST_DB_URI: postgres://mydb:mydb@postgres:5432/mydb
PGRST_DB_SCHEMA: public
PGRST_DB_ANON_ROLE: anonymous
PGRST_SERVER_PROXY_URI: http://localhost:3000
SQITCH_DEPLOY: deploy --verify
postgres:
image: postgres
restart: always
environment:
POSTGRES_DB: mydb
POSTGRES_USER: mydb
POSTGRES_PASSWORD: mydb