lesson 8
This commit is contained in:
@@ -3,8 +3,42 @@ services:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
# files are put in here
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- ./node_modules:/usr/src/app/node_modules
|
||||
command: ["yarn", "dev"]
|
||||
# Database
|
||||
|
||||
# Database: how we want to create the database
|
||||
db:
|
||||
# Image of postgres in 13th version
|
||||
image: postgres:13
|
||||
environment: #secret
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
ports: #internally the port is 5432, but we want to use 5432 locally
|
||||
- "5432:5432"
|
||||
# create a file to store stuff, store inside "data" folder
|
||||
volumes:
|
||||
- ./data:/var/lib/postgresql/data
|
||||
|
||||
# PGAdmin: visualize postgres database
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4
|
||||
environment:
|
||||
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
|
||||
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
|
||||
ports:
|
||||
# our local port is 3001, but the container port is 80
|
||||
- "3001:80"
|
||||
# creating a folder called pgadmin to store the pgadmin files
|
||||
volumes:
|
||||
- ./pgadmin:/root/.pgadmin
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
# tell docker to create something called data (refer to above) and store all the postgres data in it
|
||||
volumes:
|
||||
data:
|
||||
pgadmin:
|
||||
|
||||
Reference in New Issue
Block a user