Created
August 11, 2021 17:02
-
-
Save jprivillaso/8fad6acee2420b232f275575868b5d34 to your computer and use it in GitHub Desktop.
Docker compose to setup database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POSTGRES_USER=unicorn_user | |
POSTGRES_PASSWORD=magical_password | |
POSTGRES_DB=modern_api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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