services: web: build: . ports: - "3000:3000" # files are put in here volumes: - .:/usr/src/app - ./node_modules:/usr/src/app/node_modules command: ["yarn", "dev"] # 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: