File size: 3,139 Bytes
258fb37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
version: '3'

services:
  mongodb:
    image: mongo
    container_name: open5gs-mongodb
    ports:
      - "27017:27017"
    restart: unless-stopped
    volumes:
      - mongodb:/data/db
      - ../docs/assets/webui/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro

  webui:
    build:
      context: ../
      dockerfile: docker/webui/Dockerfile
    image: ${USER}/open5gs-webui
    container_name: open5gs-webui
    depends_on:
      - mongodb
    ports:
      - "9999:9999"
    environment:
      - DB_URI=mongodb://mongodb/open5gs
      - WAIT_HOSTS=mongodb:27017

  base:
    build:
      context: ./${DIST-ubuntu}/${TAG-latest}/base
      args:
        dist: ${DIST-ubuntu}
        tag: ${TAG-latest}
    image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-base
    command: /bin/bash -c "echo 'base' services"

  build:
    build:
      context: ../
      dockerfile: docker/build/Dockerfile
      args:
        dist: ${DIST-ubuntu}
        tag: ${TAG-latest}
        username: ${USER}
    image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-build
    depends_on:
      - base
    command: /bin/bash -c "echo 'build' services"

  run:
#    network_mode: "host"
    image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-build
    depends_on:
      - mongodb
      - build
    cap_add:
      - NET_ADMIN
    devices:
      - "/dev/net/tun:/dev/net/tun"
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
    volumes:
      - config:/etc/open5gs
    hostname: open5gs-run
#    command: /bin/bash -c "/root/setup.sh; /usr/bin/open5gs-pcrfd -D; /usr/bin/open5gs-pgwd -D; /usr/bin/open5gs-sgwd -D; /usr/bin/open5gs-hssd -D; /usr/bin/open5gs-mmed"

  test:
    image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-build
    depends_on:
      - mongodb
      - build
    environment:
      - DB_URI=mongodb://mongodb/open5gs
      - WAIT_HOSTS=mongodb:27017
    cap_add:
      - NET_ADMIN
    devices:
      - "/dev/net/tun:/dev/net/tun"
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
    hostname: open5gs-test
    command: /bin/bash -c "/root/setup.sh; cd /open5gs/build && /wait && meson test -v"

  dev:
    build:
      context: ./${DIST-ubuntu}/${TAG-latest}/dev
      args:
        dist: ${DIST-ubuntu}
        tag: ${TAG-latest}
        username: ${USER}
    image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-dev
    depends_on:
      - mongodb
      - base
    environment:
      - DB_URI=mongodb://mongodb/open5gs
      - DISPLAY=$DISPLAY
    # - DISPLAY=host.docker.internal:0
    cap_add:
      - NET_ADMIN
    devices:
      - "/dev/net/tun:/dev/net/tun"
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=0
    volumes:
      - home:/home/${USER}
      - ${HOME}:/mnt
    # - /tmp/.X11-unix:/tmp/.X11-unix
    # - /etc/localtime:/etc/localtime:ro
    # - /usr/share/zoneinfo/Europe/Helsinki:/etc/localtime:ro
    hostname: open5gs-dev
    user: ${USER}
    entrypoint: /bin/bash -c "/bin/bash -c \"$${@}\""
    command: |
        /bin/bash -c "
            sudo chmod 666 /dev/net/tun
            sudo /root/setup.sh
            /bin/bash || exit 0
        "
volumes:
  mongodb: {}
  home: {}
  config: {}