Compare commits

..
8 Commits
6 changed files with 71 additions and 16 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
-e SC2153 -e SC2153
- -
name: Lint Dockerfile name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.4.0 uses: hadolint/hadolint-action@v3.5.0
with: with:
dockerfile: Dockerfile dockerfile: Dockerfile
ignore: DL3008,DL3067 ignore: DL3008,DL3067
+2 -3
View File
@@ -1,9 +1,8 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM qemux/qemu-host:2.06 AS host
FROM scratch FROM scratch
COPY --from=qemux/qemu:7.48 / / COPY --from=qemux/qemu:7.49 / /
ARG VERSION_ARG="0.0" ARG VERSION_ARG="0.0"
ARG VERSION_CSTRUCT="4.7" ARG VERSION_CSTRUCT="4.7"
@@ -34,8 +33,8 @@ EOF
COPY --chmod=755 ./src /run/ COPY --chmod=755 ./src /run/
COPY --chmod=755 ./web /var/www/ COPY --chmod=755 ./web /var/www/
COPY --chmod=755 --from=host /qemu-host.bin /run/host.bin
COPY --chmod=744 ./web/conf/nginx.conf /etc/nginx/default.conf COPY --chmod=744 ./web/conf/nginx.conf /etc/nginx/default.conf
COPY --chmod=755 --from=qemux/qemu-host:2.06 /qemu-host.bin /run/host.bin
ADD --chmod=775 https://raw.githubusercontent.com/sud0woodo/patology/refs/heads/main/patology.py /run/extract.py ADD --chmod=775 https://raw.githubusercontent.com/sud0woodo/patology/refs/heads/main/patology.py /run/extract.py
VOLUME /storage VOLUME /storage
+5 -3
View File
@@ -25,6 +25,7 @@ An empty default means the variable is unset and its value is determined automat
| `HOST_CPU` | | CPU name reported to DSM. Selected automatically when unset. | | `HOST_CPU` | | CPU name reported to DSM. Selected automatically when unset. |
| `KVM` | `Y` | Enables KVM hardware acceleration. | | `KVM` | `Y` | Enables KVM hardware acceleration. |
| `RAM_SIZE` | `2G` | Amount of RAM assigned to DSM, such as `2G`, `4G`, `half`, or `max`. | | `RAM_SIZE` | `2G` | Amount of RAM assigned to DSM, such as `2G`, `4G`, `half`, or `max`. |
| `RAM_BACKEND` | | Guest RAM backing mechanism, set `memfd` for memfd-backed memory. |
| `RAM_CHECK` | `Y` | Checks whether enough host memory is available before starting DSM. | | `RAM_CHECK` | `Y` | Checks whether enough host memory is available before starting DSM. |
## 💾 Storage ## 💾 Storage
@@ -72,7 +73,8 @@ An empty default means the variable is unset and its value is determined automat
|---|---|---| |---|---|---|
| `DISPLAY` | `none` | Display backend, such as `vnc`, `disabled`, or `none`. | | `DISPLAY` | `none` | Display backend, such as `vnc`, `disabled`, or `none`. |
| `VGA` | `none` | QEMU video adapter model. | | `VGA` | `none` | QEMU video adapter model. |
| `GPU` | `N` | Enables experimental GPU acceleration. | | `GPU` | `N` | Enables GPU acceleration. |
| `VRAM_SIZE` | `4G` | Virtual GPU memory budget. |
| `RENDERNODE` | `/dev/dri/renderD128` | Render node used for GPU acceleration. | | `RENDERNODE` | `/dev/dri/renderD128` | Render node used for GPU acceleration. |
## 🎈 Memory Ballooning ## 🎈 Memory Ballooning
@@ -108,6 +110,6 @@ Also see [Dynamic memory allocation](https://github.com/qemus/qemu/blob/master/d
| `DEBUG` | `N` | Enables verbose debug output. | | `DEBUG` | `N` | Enables verbose debug output. |
| `TRACE` | `N` | Enables shell command tracing. | | `TRACE` | `N` | Enables shell command tracing. |
| `HOST_DEBUG` | `N` | Enables debug output for the DSM host helper. | | `HOST_DEBUG` | `N` | Enables debug output for the DSM host helper. |
| `MONITOR` | | QEMU monitor configuration. | | `MONITOR` | | QEMU monitor, such as `/storage/monitor.sock` or `4444`. |
| `QMP` | | QEMU Machine Protocol configuration. | | `QMP` | | QEMU Machine Protocol, such as `/storage/qmp.sock` or `4444`. |
| `ARGUMENTS` | | Additional raw arguments appended to the QEMU command line. | | `ARGUMENTS` | | Additional raw arguments appended to the QEMU command line. |
+19 -2
View File
@@ -203,7 +203,7 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
### How do I enable GPU acceleration? ### How do I enable GPU acceleration?
To enable hardware-accelerated graphics, add the following lines to your compose file: To enable GPU acceleration using an Intel or AMD GPU, add the following lines to your compose file:
```yaml ```yaml
environment: environment:
@@ -212,7 +212,24 @@ kubectl apply -f https://raw.githubusercontent.com/vdsm/virtual-dsm/refs/heads/m
- /dev/dri - /dev/dri
``` ```
This can be used to enable the facial recognition function in Synology Photos, but does not provide hardware transcoding for video. For NVIDIA GPUs, the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) must be installed on the host and the GPU must be exposed to the container:
```yaml
environment:
GPU: "Y"
NVIDIA_DRIVER_CAPABILITIES: "all"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities:
- gpu
```
GPU acceleration can be used to enable the facial recognition function in Synology Photos, but currently does not provide hardware transcoding for video yet.
### How do I enable dynamic memory allocation? ### How do I enable dynamic memory allocation?
+42 -5
View File
@@ -31,17 +31,54 @@ configureMemory() {
return 0 return 0
} }
normalizeSocket() {
local value="$1"
local backend="${value%%,*}"
if [[ "$backend" == *.sock && "$backend" != *:* ]]; then
value="unix:$value"
[[ ",$value," == *,server=* ]] || value+=",server=on"
if [[ ",$value," != *,wait=* ]] && [[ ",$value," != *,server=off,* ]]; then
value+=",wait=off"
fi
fi
echo "$value"
}
normalizePort() {
local value="$1"
local protocol="$2"
if [[ "$value" =~ ^[0-9]+$ ]]; then
value="$protocol:0.0.0.0:$value,server=on,wait=off"
fi
echo "$value"
}
configureMonitor() { configureMonitor() {
MON_OPTS="" MON_OPTS=""
[ -n "$QMP" ] && MON_OPTS+=" -qmp $QMP"
[ -n "$MONITOR" ] && MON_OPTS+=" -monitor $MONITOR"
MON_OPTS="${MON_OPTS# }"
local name="${APP// /-}" if [ -n "$MONITOR" ]; then
ID_OPTS="-name $name,process=$PROCESS,debug-threads=on" MONITOR=$(normalizePort "$MONITOR" "telnet")
MONITOR=$(normalizeSocket "$MONITOR")
MON_OPTS+=" -monitor $MONITOR"
fi
if [ -n "$QMP" ]; then
QMP=$(normalizePort "$QMP" "tcp")
QMP=$(normalizeSocket "$QMP")
MON_OPTS+=" -qmp $QMP"
fi
ID_OPTS="-name ${APP// /-},process=$PROCESS"
PID_OPTS="-pidfile $QEMU_PID" PID_OPTS="-pidfile $QEMU_PID"
MON_OPTS="${MON_OPTS# }"
return 0 return 0
} }
+2 -2
View File
@@ -12,8 +12,8 @@ addSystemDisks() {
setOwner "$boot" || warn "failed to set the owner for \"$boot\" !" setOwner "$boot" || warn "failed to set the owner for \"$boot\" !"
setOwner "$system" || warn "failed to set the owner for \"$system\" !" setOwner "$system" || warn "failed to set the owner for \"$system\" !"
DISK_OPTS+=$(createDevice "$boot" "$DISK_TYPE" "1" "0xa" "raw" "$DISK_IO" "$DISK_CACHE" "" "" "synoboot") DISK_OPTS+=$(createDevice "$boot" "$DISK_TYPE" "1" "0xa" "raw" "" "" "synoboot")
DISK_OPTS+=$(createDevice "$system" "$DISK_TYPE" "2" "0xb" "raw" "$DISK_IO" "$DISK_CACHE" "" "" "synosys") DISK_OPTS+=$(createDevice "$system" "$DISK_TYPE" "2" "0xb" "raw" "" "" "synosys")
return 0 return 0
} }