Below is the docker-compose file of my current development environment for a nest js app. It consists of a nest js api, mysql database. adminer and a nginx reverse proxy. It´s perfect for local development. However, i´struggling to deploy this to digital ocean. How would a setup for production look like?

version: '3.7'

services:

  nest-api:
    build:
      context: server/.
      target: build  
    environment:
      - VIRTUAL_HOST=api.proto.io
      - VIRTUAL_PORT=3000
      - DB_HOST=db
    command: npm run start:dev
    ports:
      - 3000:3000
    volumes:
      - ./server:/usr/src/app
      - /usr/src/app/node_modules
    depends_on:
      - db
    links:
      - db

  db:
    image: mysql:8.0
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=example
      - MYSQL_DATABASE=proto
    volumes:
      - mysqldata:/var/lib/mysql

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
    environment:
      - VIRTUAL_HOST=db.proto.io
      - VIRTUAL_PORT=8080

  nginx:
    container_name: proto-proxy
    image: jwilder/nginx-proxy
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
    ports:
      - "8181:80"

volumes:
  mysqldata:

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!