#version: '3'

# install docker deb package

# apt-get update 
# apt-get install wget
# wget http://demogitjava.ddns.net:8000/serverconfig/debian/docker-cli_26.1.5+dfsg1-4_amd64.deb
# dpkg -i docker-cli_26.1.5+dfsg1-4_amd64.deb

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

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

services:
    
    httpdfileserver:
        stdin_open: true
        tty: true
        container_name: httpfileserver
        network_mode: host
        #ports:
        #    - 0.0.0.0:8000:8000
        ports:
        - target: 8000
          host_ip: 127.0.0.1
          published: 8000
          protocol: tcp
          mode: host
        #runtime: runc
        runtime: io.containerd.runc.v2
        
        
        #runtime: io.containerd.kata.v2
        #blkio_config:
        #    weight: 100
        environment:
            - VLAN=10
            - TZ=CET-1
            - NTP_SERVER=2.rhel.pool.ntp.org
            - NETWORK_IF=ens6
            #- QEMU_ARCH=${QEMU_ARCH:-cortex-a72}
            #- QEMU_ARCH=${Sun-UltraSparc-IIIi-plus}
            - QEMU_ARCH=${QEMU_ARCH:-SPARC32PLUS}
            - enable-kvm 
        extra_hosts:
            - "host.docker.internal:host-gateway"
        #extra_hosts:
        #    - demogitjava.ddns.net:217.160.255.254
       # platform: linux/amd64
        volumes:
            - /srv/www/htdocs:/usr/local/apache2/htdocs:X
            - /var/run/docker.sock:/var/run/docker.sock:X
        devices:
            # sun sparc
            - /dev/kvm
            - /dev/net/tun
            - sandbox on
            - e1000,mac=02:01:0e:dc:9c:00,netdev=ens6,net=217.160.255.254/32
            - ide-hd,netdev=ens6,bus=sata.4,drive=SystemDisk,cpu host,
            #machine niagara=kvm:tcg  
            #server
            - maschine SS-600MP
             # network
            - netdev user,id=ens6,hostfwd=tcp::8000-:8000 -device e1000,netdev=ens6
            
               # bios path must set
            #- bios http://demogitjava.ddns.net:8000/qemu/bios/openbios-sparc32
            - bios /root/openbios-sparc32.bin
            - e1000,netdev=ens6,net=217.160.255.254/32
            - virtualization=on
            
             # qemu dns
            - nic user,dns=95.85.95.85
            - nic user,dns=2.56.220.2
            
            # optional vga
            - vga qxl 
            
            
            - enable-kvm 
            - kernel 'bzImage' 
            
            # Accelerator
            - accel kvm
            - net nic,vlan=landingpagevlan
            # x86
            #- /dev/kvm
            #- /dev/net/tun
            #- virtio-net-pci,mac=02:01:0e:dc:9c:00,netdev=ens6,net=217.160.255.254/32
            #- ide-hd,bus=sata.4,drive=SystemDisk,machine niagara  
        cap_add:
            - NET_ADMIN
            - SYS_ADMIN
            - SYS_TIME
        #dns: 
        #    - 95.85.95.85
        #    - 2.56.220.2
        privileged: true
        isolation: default
        restart: unless-stopped
        platform: linux/amd64
        #isolation: default
        #cpu_quota: "2000"
        #cpu_period: "2000"
        #cpu_shares: 1024
        #networks:
        #    172.17.0.0:
        #        ipv4_address: 172.17.0.100
        image: jgsoftwares/httpdfileserver:dockercli
        security_opt:
             #- apparmor=docker-default
             - no-new-privileges=true
             - apparmor:unconfined
             - label=type:container_runtime_t
           
        #depends_on:
        #     - openwrt23docker
        deploy:
            mode: global
            
        dns:
            # no ip
           - "194.62.181.53" 
           - "194.62.180.53" 
           - "204.16.255.53" 
           - "204.16.254.53" 
            # google 
           - "8.8.8.8" 
           - "8.8.4.4" 
#networks:
#   172.17.0.0:
#      external: true
#     name: 172.17.0.0


#networks:
#   eth0:
#      driver: macvlan
#      driver_opts:
#          parent: eth0
#      ipam:
#          driver: default
networks:
 # frontend
 vlan10:
    name: wan
    driver: ipvlan
    #driver: macvlan
    driver_opts:
      parent: eth0.10
      ipvlan_mode: l3
    ipam:
      config:
        - subnet: 217.160.255.254/32
          gateway: 217.160.255.254