From 0c8a8d40ea03e0ef7d92cb73a29fc9714338fa8a Mon Sep 17 00:00:00 2001 From: MentatBot <160964065+MentatBot@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:04:02 +0000 Subject: [PATCH 1/5] Fix Docker build by adding linux-headers dependency Added linux-headers to Alpine package installation to fix psutil compilation error. This package is required for psutil to build its C extensions on Alpine Linux. Co-authored-by: TrueBankai416 <97103466+TrueBankai416@users.noreply.github.com> --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index d636ae00..f4c4d1ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ ADD . /rustdesk-api-server RUN apk add --no-cache \ gcc \ musl-dev \ + linux-headers \ mariadb-connector-c-dev \ pkgconfig From 64cb491edaff3431795604019a4345150d7ca8b3 Mon Sep 17 00:00:00 2001 From: MentatBot <160964065+MentatBot@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:08:23 +0000 Subject: [PATCH 2/5] Optimize Dockerfile for smaller image size - Updated base image from python:3.10.3-alpine to python:3.10-alpine for better maintenance and automatic security updates - Used virtual build dependencies that are removed after pip install to significantly reduce final image size - Added pillow dependencies (zlib-dev, jpeg-dev, freetype-dev) to prevent potential build failures - Consolidated RUN commands to reduce image layers Co-authored-by: TrueBankai416 <97103466+TrueBankai416@users.noreply.github.com> --- Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f4c4d1ac..0efb4daf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,20 @@ -FROM python:3.10.3-alpine +FROM python:3.10-alpine WORKDIR /rustdesk-api-server ADD . /rustdesk-api-server -# 安装系统依赖 -RUN apk add --no-cache \ +# Install build dependencies and Python packages, then clean up +RUN apk add --no-cache --virtual .build-deps \ gcc \ musl-dev \ linux-headers \ mariadb-connector-c-dev \ - pkgconfig - -RUN set -ex \ + pkgconfig \ + zlib-dev \ + jpeg-dev \ + freetype-dev \ && pip install --no-cache-dir --disable-pip-version-check -r requirements.txt \ - && rm -rf /var/cache/apk/* \ + && apk del .build-deps \ && cp -r ./db ./db_bak ENV HOST="0.0.0.0" From 79f9576d1b21b8999ae4032b0ea46f72dc06b843 Mon Sep 17 00:00:00 2001 From: MentatBot <160964065+MentatBot@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:10:14 +0000 Subject: [PATCH 3/5] Fix runtime library dependencies for Pillow and MariaDB Separated runtime libraries from build dependencies to prevent runtime errors. Runtime libs (zlib, jpeg, freetype, mariadb-connector-c) are now kept in the final image, while build-time dependencies (compilers and -dev packages) are removed after pip install. This ensures Pillow and database functionality work correctly at runtime while still maintaining a smaller image size. Co-authored-by: TrueBankai416 <97103466+TrueBankai416@users.noreply.github.com> --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0efb4daf..aa6ed44b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,13 @@ FROM python:3.10-alpine WORKDIR /rustdesk-api-server ADD . /rustdesk-api-server -# Install build dependencies and Python packages, then clean up -RUN apk add --no-cache --virtual .build-deps \ +# Install runtime dependencies, build dependencies, then clean up build deps +RUN apk add --no-cache \ + zlib \ + jpeg \ + freetype \ + mariadb-connector-c \ + && apk add --no-cache --virtual .build-deps \ gcc \ musl-dev \ linux-headers \ From ea2915d4aad416be884afccbdb2a6b9709496f4e Mon Sep 17 00:00:00 2001 From: MentatBot <160964065+MentatBot@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:12:10 +0000 Subject: [PATCH 4/5] Add PNG support and improve Docker build caching - Added libpng runtime and libpng-dev build dependencies for full Pillow PNG support (needed for icon/logo uploads) - Improved build caching by copying requirements.txt first, then installing dependencies, then copying the rest of the app - Changed ADD to COPY (Docker best practice) - Better organized RUN commands with clearer structure and comments Co-authored-by: TrueBankai416 <97103466+TrueBankai416@users.noreply.github.com> --- Dockerfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index aa6ed44b..21fe62c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ FROM python:3.10-alpine WORKDIR /rustdesk-api-server -ADD . /rustdesk-api-server + +# Copy requirements first for better build caching +COPY requirements.txt . # Install runtime dependencies, build dependencies, then clean up build deps RUN apk add --no-cache \ zlib \ jpeg \ + libpng \ freetype \ mariadb-connector-c \ && apk add --no-cache --virtual .build-deps \ @@ -17,10 +20,16 @@ RUN apk add --no-cache \ pkgconfig \ zlib-dev \ jpeg-dev \ + libpng-dev \ freetype-dev \ && pip install --no-cache-dir --disable-pip-version-check -r requirements.txt \ - && apk del .build-deps \ - && cp -r ./db ./db_bak + && apk del .build-deps + +# Copy the rest of the application +COPY . . + +# Backup database directory +RUN cp -r ./db ./db_bak ENV HOST="0.0.0.0" ENV TZ="Asia/Shanghai" From 3b6e3a3f2a244e32d001edb9f31ec705967c9a0f Mon Sep 17 00:00:00 2001 From: MentatBot <160964065+MentatBot@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:49:09 +0000 Subject: [PATCH 5/5] Fix rdgen flag to enable GitHub releases and client downloads Changed extras['rdgen'] from 'false' to 'true' in the generator view. This enables the rdgen workflow to: - Create GitHub releases with built clients - Call back to save files to clients/custom/ - Update build status properly Fixes issue where generated clients weren't appearing in the Client Downloads tab. Co-authored-by: TrueBankai416 <97103466+TrueBankai416@users.noreply.github.com> --- api/views_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/views_generator.py b/api/views_generator.py index 4d14ba38..30d6a9df 100644 --- a/api/views_generator.py +++ b/api/views_generator.py @@ -174,7 +174,7 @@ def generator_view(request): extras['downloadLink'] = downloadLink extras['delayFix'] = 'true' if delayFix else 'false' extras['version'] = version - extras['rdgen'] = 'false' + extras['rdgen'] = 'true' extras['cycleMonitor'] = 'true' if cycleMonitor else 'false' extras['xOffline'] = 'true' if xOffline else 'false' extras['hidecm'] = 'true' if hidecm else 'false'