Skip to content

Commit 6f9b2e5

Browse files
feat: add DRI support
1 parent 697b49e commit 6f9b2e5

5 files changed

Lines changed: 29 additions & 8 deletions

File tree

app-server/appserver_linux_amd64

152 Bytes
Binary file not shown.

app-server/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type Config struct {
1212
SECRET string `ini:"SECRET"`
1313
FSROOT string `ini:"FSROOT"`
1414
SECURE bool `ini:"SECURE"`
15+
DRI bool `ini:"DRI"`
1516
} `ini:"Configuration"`
1617
}
1718

app-server/config.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ SERVER = https://localhost:3000
33
REPOSITORY = localhost:5000
44
SECRET = q@4iMlcS!AnMC74ZfxB0GNh623VN!Qo*Jf$6wuKBFZ*f0doBJ1
55
FSROOT = /tmp/appvirt/
6-
SECURE = true
6+
SECURE = true
7+
DRI = true

app-server/dockercontroller.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,32 @@ func StartDockerImage(imageName string, port string, volume string, close chan s
2929
return
3030
}
3131

32+
//Punts de muntatje
33+
mounts := []mount.Mount{
34+
{
35+
Type: mount.TypeBind,
36+
Source: volume,
37+
Target: "/SHARED",
38+
},
39+
}
40+
41+
if GLOBAL.Configuration.DRI {
42+
driMount := mount.Mount{
43+
Type: mount.TypeBind,
44+
Source: "/dev/dri",
45+
Target: "/dev/dri",
46+
}
47+
mounts = append(mounts, driMount)
48+
}
49+
3250
//Inicialitza el contenidor
3351
resp, err := dockerCli.ContainerCreate(context.Background(), &container.Config{
3452
Image: fmt.Sprintf("%s/%s", GLOBAL.Configuration.REPOSITORY, imageName),
3553
Env: []string{"PROXY_PORT="+port,"DISPLAY=:"+strconv.Itoa(display)},
3654
}, &container.HostConfig{
3755
NetworkMode: container.NetworkMode("host"),
3856
AutoRemove: true,
39-
Mounts: []mount.Mount{
40-
{
41-
Type: mount.TypeBind,
42-
Source: volume,
43-
Target: "/SHARED",
44-
},
45-
},
57+
Mounts: mounts,
4658
}, nil, nil, "")
4759
if err != nil {
4860
log.Println("Error en crear el contenidor de la imatge de docker", err)

install/install_appserver.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ read -p "Escriu el host i port del repositori d'imatges [Per defecte: localhost:
1616
repo=${repo:-"localhost:5000"}
1717
read -p "Escriu el path on muntar el sistema de fitxers virtual [Per defecte: /tmp/appvirt/]: " path
1818
path=${path:-"/tmp/appvirt/"}
19+
read -p "Vols utilitzar DRI (Direct Rendering Infrastructure)? [S/n]: " sino
20+
dri="true"
21+
case $sino in
22+
[Nn]* ) dri="false" ;;
23+
* ) dri="true";;
24+
esac
1925

2026
#Certificat autosignat
2127
if [[ $url == https://* ]]; then
@@ -50,6 +56,7 @@ REPOSITORY = $repo
5056
SECRET = $secret
5157
FSROOT = $path
5258
SECURE = $https
59+
DRI = $dri
5360
EOF
5461

5562
#Permetre registres inseguurs

0 commit comments

Comments
 (0)