Skip to content

Instantly share code, notes, and snippets.

@adriangabardo
Created August 27, 2023 02:50
Show Gist options
  • Save adriangabardo/08dea232e153a5ac7746d296ac906fd2 to your computer and use it in GitHub Desktop.
Save adriangabardo/08dea232e153a5ac7746d296ac906fd2 to your computer and use it in GitHub Desktop.
docker
services:
postgres:
image: postgres:14.1-alpine
restart: always
environment:
# You can set the value of environment variables
# in your docker-compose.yml file
# Our Node app will use these to connect
# to the database
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=root
ports:
# Standard port for PostgreSQL databases
- '5432:5432'
volumes:
# When the PostgresSQL container is started it will run any scripts
# provided in the `docker-entrypoint-initdb.d` directory, this connects
# our seed file to that directory so that it gets run
# Note that these only run IF THE CONTAINER IS EMPTY, so as soon as the
# database is populated these scripts will not run again
- ./bin/database-seed.sql:/docker-entrypoint-initdb.d/database-seed-copy.sql
# This is where our database data will be stored
- ./data:/var/lib/postgresql/data
# PostgreSQL pgAdmin panel accessible at http://localhost:16543/
pgadmin-compose:
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: 'adriangabardo@gmail.com'
PGADMIN_DEFAULT_PASSWORD: 'Fakepassword123!'
ports:
- '16543:80'
depends_on:
- postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment