Skip to content

suzel/docker-postgrest

Repository files navigation

PostgREST Docker Image

Version Build Status Documentation Docker Stars

PostgREST serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant, faster API than you are likely to write from scratch.

Installation

The easiest way to get this docker image installed is to pull the latest version from the Docker registry:

docker pull suzel/docker-postgrest

or build from source:

git clone https://github.com/suzel/docker-postgrest.git
cd docker-postgrest/
docker build -t suzel/docker-postgrest --build-arg POSTGREST_VERSION=7.0.1 .

Usage

Start your image binding external port 3000 in all interfaces to your container:

docker-compose.yml

version: "3.1"

services:
  # https://github.com/suzel/docker-postgrest
  postgrest:
    build:
      context: .
      args:
        POSTGREST_VERSION: "7.0.1"
    ports:
      - "3000:3000"
    environment:
      PGRST_DB_URI: postgres://app_user:secret@postgres:5432/app_db
      PGRST_DB_SCHEMA: public
      PGRST_DB_ANON_ROLE: app_user
    links:
      - postgres:postgres

  # https://github.com/sosedoff/pgweb
  pgweb:
    image: sosedoff/pgweb
    ports:
      - "8081:8081"
    links:
      - postgres:postgres
    environment:
      - DATABASE_URL=postgres://app_user:secret@postgres:5432/app_db?sslmode=disable
    depends_on:
      - postgres

  # https://hub.docker.com/_/postgres/
  postgres:
    image: postgres:alpine
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: app_db
      POSTGRES_USER: app_user
      POSTGRES_PASSWORD: secret
    volumes:
      - postgres-data:/var/lib/postgresql/data
      # - ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql

volumes:
  postgres-data: {}

build and start:

docker-compose up -d --build

You can the visit the following URL in a browser on your host machine to get started:

# Open PostgREST Service
http://localhost:3000/

# Open database browser (pgweb)
http://localhost:8081/

License

The source code is licensed under the MIT license.

About

REST API for any Postgres database (PostgREST Docker Image)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors