version: '3' services: nginx: image: 'nginx:1.19.6-alpine' working_dir: "/usr/share/nginx/html" volumes: # individual files require full path: - ${PWD}/nginx/default.conf:/etc/nginx/conf.d/default.conf - ${PWD}/nginx/public_html:/usr/share/nginx/html ports: - "3001:80" depends_on: - node node: build: context: ./node/ dockerfile: Dockerfile # production: no reason to use pm2 if docker offers auto-restart # development: don't use docker auto-restart; rather pm2, which can watch for file changes #restart: always user: "node" environment: - NODE_ENV=development volumes: - ./node/:/home/node/app expose: - "80" depends_on: - postgres working_dir: /home/node/app # for production (no file watching): # command: sh -c "yarn install && node server.js" # for development (file watching/reloading): command: sh -c "yarn install && yarn pm2-dev server.js" postgres: image: "postgres:13.1-alpine" environment: - POSTGRES_USER=pastebin - POSTGRES_PASSWORD=buginoo volumes: - ./postgres/pgdata:/var/lib/postgresql/data expose: - "5432"