Skip to content

Instantly share code, notes, and snippets.

@Gershon-A
Created August 6, 2022 09:59
Show Gist options
  • Save Gershon-A/50d08a4a9a45d0437862733a282fb611 to your computer and use it in GitHub Desktop.
Save Gershon-A/50d08a4a9a45d0437862733a282fb611 to your computer and use it in GitHub Desktop.
Docker compose to create postgrest, swagger and pgadmin
# docker-compose.yml
version: '3'
services:
server:
image: postgrest/postgrest
ports:
- "3000:3000"
environment:
PGRST_DB_URI: postgres://app_user:password@db:5432/app_db
PGRST_DB_SCHEMAS: public
PGRST_DB_ANON_ROLE: app_user #In production this role should not be the same as the one used for the connection
PGRST_OPENAPI_SERVER_PROXY_URI: http://127.0.0.1:3000
depends_on:
- db
db:
image: postgres
ports:
- "5432:5432"
environment:
POSTGRES_DB: app_db
POSTGRES_USER: app_user
POSTGRES_PASSWORD: password
# Uncomment this if you want to persist the data.
# volumes:
# - "./pgdata:/var/lib/postgresql/data"
swagger:
image: swaggerapi/swagger-ui
ports:
- "8080:8080"
expose:
- "8080"
environment:
API_URL: http://localhost:3000/
# pgAdmin
pgadmin:
container_name: pgadmin4_container
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: root
ports:
- "5050:80"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment