services:
  samba:
    image: docker.io/dperson/samba
    container_name: samba
    restart: always
    ports:
      - "1139:139"
      - "1445:445"
    volumes:
      - ${SHARED_FOLDER:?}:/mnt/shared
    environment:
      - TZ=Europe/Samara
      - USERID=${OWNER_USERID:?} # UID вашего пользователя в Linux (id -u)
      - GROUPID=${OWNER_GROUPID:?} # GID вашего пользователя в Linux (id -g)

    command: >
      -u "${SMB_USER:?};${SMB_PASSWORD:?}"
      -s "${READONLY_NET_NAME:?};/mnt/shared;yes;yes;yes"
      -s "${NET_NAME:?};/mnt/shared;yes;no;no;${SMB_USER:?}"
      -g "acl allow execute always = yes"
      -g "map archive = yes"
      -g "client max protocol = SMB3"
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 512M
        reservations:
          memory: 128M
    networks:
      - samba_network

networks:
  samba_network:
    name: samba_network
    driver: bridge
