version: "3"
services:
  nginx:
    image: jwilder/nginx-proxy:alpine
    restart: unless-stopped
    networks:
      - frontend
      - backend
    ports:
      - "443:443"
    volumes:
      - ./ssl:/etc/nginx/certs
      - /var/run/docker.sock:/tmp/docker.sock:ro

  teampass-web:
    image: dormancygrace/teampass:latest
    restart: unless-stopped
    environment:
      VIRTUAL_HOST: YOUR_HOSTNAME
      VIRTUAL_PORT: 80
      # uncomment if certificate's file name doesn't match VIRTUAL_HOST
      #CERT_NAME: YOUR_CERTIFICATE
    volumes:
      - ./teampass-html:/var/www/html
    # uncomment ports to use without proxy
    #ports:
    #  - 80:80
    networks:
      - teampass-internal
      - backend
    depends_on:
      - db
  db:
    restart: unless-stopped
    image: yobasystems/alpine-mariadb:latest
    environment:
      MYSQL_ROOT_PASSWORD: YOUR_SUPERSECRET_PASSWORD
      MYSQL_DATABASE: teampass
      MYSQL_PASSWORD: YOUR_SECRET_PASSWORD
      MYSQL_USER: teampass
    volumes:
      - ./teampass-db:/var/lib/mysql
    networks:
      - teampass-internal

networks:
  frontend:
  backend:
    external: true
  teampass-internal:
