Skip to content

Instantly share code, notes, and snippets.

@jprivillaso
Created August 11, 2021 17:02
Show Gist options
  • Save jprivillaso/8fad6acee2420b232f275575868b5d34 to your computer and use it in GitHub Desktop.
Save jprivillaso/8fad6acee2420b232f275575868b5d34 to your computer and use it in GitHub Desktop.
Docker compose to setup database
POSTGRES_USER=unicorn_user
POSTGRES_PASSWORD=magical_password
POSTGRES_DB=modern_api
version: '3'
services:
database:
image: 'postgres'
restart: always
ports:
- "5432:5432"
env_file:
- ./env/database.env
networks:
- my_network
volumes:
- database-data:/var/lib/postgresql/data/
- ./ops/init.sql:/docker-entrypoint-initdb.d/docker_postgres_init.sql
volumes:
database-data:
networks:
my_network:
driver: bridge
SELECT current_database();
CREATE TABLE increment (
counter_key VARCHAR ( 250 ) PRIMARY KEY,
counter_value int NOT null
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment