#version: '3'

# network none 


# run container over podman
#podman compose up -d --build

#run container over docker
#docker compose up -d --build


services:
    openwrt-x86-generic-rootfs:
        stdin_open: true
        tty: true
        ports: 
           # - 0.0.0.0:22:22
            - 0.0.0.0:23:23
            - 0.0.0.0:80:80
            - 0.0.0.0:53:53
            - 0.0.0.0:123:123
            - 0.0.0.0:323:323   
            - 0.0.0.0:8000:8000  
            - 0.0.0.0:8082:8082
            - 0.0.0.0:8443:8443
            - 0.0.0.0:51820:51820     
        container_name: openwrtgerneric_rootfs
        runtime: io.containerd.runc.v2
        isolation: default
        
        environment:
           
            - TZ=CET-1
            - NETWORK_IF=virbr0
            - QEMU_CPU=1
            - QEMU_RAM=4
            #- QEMU_ARCH=${QEMU_ARCH:-cortex-a72}
            
            - QEMU_ARCH=${cortex-m0plus}
            - NTP_SERVERS="demogitjava.ddns.net"
            
        #blkio_config:
        #    weight: 100
        # cpu_shares: 1024
        # cpu_quota: "1000"
        # cpu_period: "1000"
        network_mode: none
        #hostname: demogitjava.ddns.net
        #extra_hosts:
        #    - demogitjava.ddns.net:217.160.255.254
        #platform: linux/arm64
        restart: unless-stopped
        privileged: true
        cap_add:
            - NET_ADMIN
            - SYS_ADMIN
            - SYS_TIME
        devices:  
            - /dev/kvm
            - /dev/net/tun
            - sandbox on
            
          
            # optional vga
            - vga qxl 
            
            # net
            - net nic,model=rtl8139
            
            # qemu dns
            - nic user,dns=95.85.95.85
            - nic user,dns=2.56.220.2
            
            - enable-kvm 
          
            # Accelerator
            - accel kvm
           
            
            
            - M pc-q35-2.0 
            #- drive file=openwrt-x86_64-combined-ext4.vdi,id=d0,if=none 
            # nvme
            - nvme,drive=nvme0,serial=deadbeaf1,num_queues=8
            #- machine sun4m=kvm:tcg
            
            # memory 
            - nvdimm,memdev=md1,id=nvdimm1
            #- m 2G,maxmem=8G,slots=4 -object memory-backend-ram
            - nvdimm -m 0.1G,maxmem=0.2G,slots=4 -object memory-backend-ram
        
        #    - 95.85.95.85
        #    - 2.56.220.2
        image: jgsoftwares/openwrt-x86-generic-rootfs:gcore
        #depends_on:
        #    # switch
        #    - openswitchd
        deploy:
            mode: global
            resources:
                limits:
                  #cpus: '2'
                  memory: 2048M
                reservations:
                  #cpus: '0.25'
                  memory: 512M
        command: /bin/ash

