Paolo Asperti лет назад: 3
Родитель
Сommit
104fb00d88
3 измененных файлов с 246 добавлено и 14 удалено
  1. 101 7
      .github/workflows/build.yaml
  2. 141 7
      README.md
  3. 4 0
      docker-classic/Dockerfile

+ 101 - 7
.github/workflows/build.yaml

@@ -2,7 +2,8 @@ name: build
2 2
 
3 3
 # ------------- NOTE
4 4
 # please setup some secrets before running this workflow:
5
-# DOCKER_IMAGE should be the target image name on docker hub (e.g. "rustdesk/rustdesk-server" )
5
+# DOCKER_IMAGE should be the target image name on docker hub (e.g. "rustdesk/rustdesk-server-s6" )
6
+# DOCKER_IMAGE_CLASSIC should be the target image name on docker hub for the old build (e.g. "rustdesk/rustdesk-server" )
6 7
 # DOCKER_USERNAME is the username you normally use to login at https://hub.docker.com/
7 8
 # DOCKER_PASSWORD is a token you should create under "account settings / security" with read/write access
8 9
 
@@ -15,10 +16,11 @@ on:
15 16
 
16 17
 env:
17 18
   CARGO_TERM_COLOR: always
18
-  LATEST_TAG: devel
19
-
19
+  LATEST_TAG: latest
20
+  
20 21
 jobs:
21 22
 
23
+  # binary build
22 24
   build:
23 25
 
24 26
     name: Build - ${{ matrix.job.name }}
@@ -64,7 +66,7 @@ jobs:
64 66
             target/${{ matrix.job.target }}/release/hbbs
65 67
           if-no-files-found: error
66 68
 
67
-
69
+  # github (draft) release with all binaries
68 70
   release:
69 71
 
70 72
     name: Github release
@@ -110,7 +112,7 @@ jobs:
110 112
             armv7/*
111 113
             i386/*
112 114
             
113
-
115
+  # docker build and push of single-arch images
114 116
   docker:
115 117
 
116 118
     name: Docker push - ${{ matrix.job.name }}
@@ -158,6 +160,14 @@ jobs:
158 160
         with:
159 161
           images: registry.hub.docker.com/${{ secrets.DOCKER_IMAGE }}
160 162
 
163
+      - name: Get git tag
164
+        id: vars
165
+        run: |
166
+          T=${GITHUB_REF#refs/*/}
167
+          M=${T%%.*}
168
+          echo "GIT_TAG=$T" >> $GITHUB_ENV
169
+          echo "MAJOR_TAG=$M" >> $GITHUB_ENV
170
+
161 171
       - name: Build and push Docker image
162 172
         uses: docker/build-push-action@v3
163 173
         with:
@@ -166,10 +176,11 @@ jobs:
166 176
           push: true
167 177
           tags: |
168 178
             ${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-${{ matrix.job.name }}
169
-            ${{ secrets.DOCKER_IMAGE }}:${{ github.ref_name }}-${{ matrix.job.name }}
179
+            ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-${{ matrix.job.name }}
180
+            ${{ secrets.DOCKER_IMAGE }}:${{ env.MAJOR_TAG }}-${{ matrix.job.name }}
170 181
           labels: ${{ steps.meta.outputs.labels }}
171 182
 
172
-
183
+  # docker build and push of multiarch images
173 184
   docker-manifest:
174 185
 
175 186
     name: Docker manifest
@@ -185,6 +196,31 @@ jobs:
185 196
           username: ${{ secrets.DOCKER_USERNAME }}
186 197
           password: ${{ secrets.DOCKER_PASSWORD }}
187 198
 
199
+      - name: Get git tag
200
+        id: vars
201
+        run: |
202
+          T=${GITHUB_REF#refs/*/}
203
+          M=${T%%.*}
204
+          echo "GIT_TAG=$T" >> $GITHUB_ENV
205
+          echo "MAJOR_TAG=$M" >> $GITHUB_ENV
206
+
207
+      # manifest for :1.2.3 tag
208
+      - name: Create and push manifest
209
+        uses: Noelware/docker-manifest-action@master
210
+        with:
211
+          base-image: ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}
212
+          extra-images: ${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-amd64,${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-arm64v8,${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-armv7,${{ secrets.DOCKER_IMAGE }}:${{ env.GIT_TAG }}-i386
213
+          push: true
214
+
215
+      # manifest for :1 tag (major release)
216
+      - name: Create and push manifest
217
+        uses: Noelware/docker-manifest-action@master
218
+        with:
219
+          base-image: ${{ secrets.DOCKER_IMAGE }}:${{ env.MAJOR_TAG }}
220
+          extra-images: ${{ secrets.DOCKER_IMAGE }}:${{ env.MAJOR_TAG }}-amd64,${{ secrets.DOCKER_IMAGE }}:${{ env.MAJOR_TAG }}-arm64v8,${{ secrets.DOCKER_IMAGE }}:${{ env.MAJOR_TAG }}-armv7,${{ secrets.DOCKER_IMAGE }}:${{ env.MAJOR_TAG }}-i386
221
+          push: true
222
+
223
+      # manifest for :latest tag
188 224
       - name: Create and push manifest
189 225
         uses: Noelware/docker-manifest-action@master
190 226
         with:
@@ -198,3 +234,61 @@ jobs:
198 234
           base-image: ${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}
199 235
           extra-images: ${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-amd64,${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-arm64v8,${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-armv7,${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-i386
200 236
           push: true
237
+
238
+
239
+            
240
+  # docker build and push of classic images
241
+  docker-classic:
242
+
243
+    name: Docker push classic - ${{ matrix.job.name }}
244
+    needs: build
245
+    runs-on: ubuntu-22.04
246
+    strategy:
247
+      fail-fast: false
248
+      matrix:
249
+        job:
250
+          - { name: "amd64",   docker_platform: "linux/amd64", tag: "latest" }
251
+          - { name: "arm64v8", docker_platform: "linux/arm64", tag: "latest-arm64v8" }
252
+
253
+    steps:
254
+
255
+      - name: Checkout
256
+        uses: actions/checkout@v3
257
+        
258
+      - name: Download binaries
259
+        uses: actions/download-artifact@v3
260
+        with:
261
+          name: binaries-${{ matrix.job.name }}
262
+          path: docker-classic/
263
+
264
+      - name: Make binaries executable
265
+        run: chmod -v a+x docker-classic/hbb*
266
+
267
+      - name: Set up QEMU
268
+        uses: docker/setup-qemu-action@v2
269
+      
270
+      - name: Set up Docker Buildx
271
+        uses: docker/setup-buildx-action@v2
272
+
273
+      - name: Log in to Docker Hub
274
+        if: github.event_name != 'pull_request'
275
+        uses: docker/login-action@v2
276
+        with:
277
+          username: ${{ secrets.DOCKER_USERNAME }}
278
+          password: ${{ secrets.DOCKER_PASSWORD }}
279
+        
280
+      - name: Extract metadata (tags, labels) for Docker
281
+        id: meta
282
+        uses: docker/metadata-action@v4
283
+        with:
284
+          images: registry.hub.docker.com/${{ secrets.DOCKER_IMAGE_CLASSIC }}
285
+
286
+      - name: Build and push Docker image
287
+        uses: docker/build-push-action@v3
288
+        with:
289
+          context: "./docker-classic"
290
+          platforms: ${{ matrix.job.docker_platform }}
291
+          push: true
292
+          tags: |
293
+            ${{ secrets.DOCKER_IMAGE_CLASSIC }}:${{ matrix.job.tag }}
294
+          labels: ${{ steps.meta.outputs.labels }}

+ 141 - 7
README.md

@@ -1,27 +1,161 @@
1
-[![build](https://github.com/rustdesk/rustdesk-server/actions/workflows/build.yaml/badge.svg)](https://github.com/rustdesk/rustdesk-server/actions/workflows/build.yaml)
2
-
3 1
 # RustDesk Server Program
4 2
 
3
+[![build](https://github.com/rustdesk/rustdesk-server/actions/workflows/build.yaml/badge.svg)](https://github.com/rustdesk/rustdesk-server/actions/workflows/build.yaml)
4
+
5 5
 [**Download**](https://github.com/rustdesk/rustdesk-server/releases)
6 6
 
7
-[**Manual**](https://rustdesk.com/docs/en/self-host/) 
7
+[**Manual**](https://rustdesk.com/docs/en/self-host/)
8 8
 
9 9
 [**FAQ**](https://github.com/rustdesk/rustdesk/wiki/FAQ)
10 10
 
11 11
 Self-host your own RustDesk server, it is free and open source.
12 12
 
13
+## How to build manually
14
+
13 15
 ```bash
14 16
 cargo build --release
15 17
 ```
16 18
 
17 19
 Two executables will be generated in target/release.
18
-  - hbbs - RustDesk ID/Rendezvous server
19
-  - hbbr - RustDesk relay server
20
+
21
+- hbbs - RustDesk ID/Rendezvous server
22
+- hbbr - RustDesk relay server
23
+
24
+You can find updated binaries on the [releases](https://github.com/rustdesk/rustdesk-server/releases) page.
20 25
 
21 26
 If you wanna develop your own server, [rustdesk-server-demo](https://github.com/rustdesk/rustdesk-server-demo) might be a better and simpler start for you than this repo.
22 27
 
23
-## docker-compose
28
+## Docker images
29
+
30
+Docker images are automatically generated and published on every github release. We have 2 kind of images.
31
+
32
+### Classic image
33
+
34
+These images are build against `ubuntu-20.04` with the only addition of the binaries (both hbbr and hbbs). They're available on [Docker hub](https://hub.docker.com/r/rustdesk/rustdesk-server/) with these tags:
35
+
36
+| architecture | image:tag |
37
+| --- | --- |
38
+| amd64 | `rustdesk/rustdesk-server:latest` |
39
+| arm64v8 | `rustdesk/rustdesk-server:latest-arm64v8` |
40
+
41
+You can start these images directly with `docker run` with these commands:
42
+
43
+```bash
44
+docker run --name hbbs -p 21115:21115 -p 21116:21116 -p 21116:21116/udp -p 21118:21118 -v "$PWD:/root" -d rustdesk/rustdesk-server:latest hbbs -r <relay-server-ip[:port]> 
45
+docker run --name hbbr -p 21117:21117 -p 21119:21119 -v "$PWD:/root" -d rustdesk/rustdesk-server:latest hbbr 
46
+```
47
+
48
+The `relay-server-ip` parameter is the IP address (or dns name) of the server running these containers. The **optional** `port` parameter has to be used if you use a port different than **21117** for `hbbr`.
49
+
50
+You can also use docker-compose, using this configuration as a template:
51
+
52
+```yaml
53
+version: '3'
54
+
55
+networks:
56
+  rustdesk-net:
57
+    external: false
24 58
 
25
-If you have Docker and would like to use it, an included `docker-compose.yml` file is included. Edit line 16 to point to your relay server (the one listening on port 21117). You can also edit the volume lines (L18 and L33) if you need.
59
+services:
60
+  hbbs:
61
+    container_name: hbbs
62
+    ports:
63
+      - 21115:21115
64
+      - 21116:21116
65
+      - 21116:21116/udp
66
+      - 21118:21118
67
+    image: rustdesk/rustdesk-server:latest
68
+    command: hbbs -r rustdesk.example.com:21117
69
+    volumes:
70
+      - ./hbbs:/root
71
+    networks:
72
+      - rustdesk-net
73
+    depends_on:
74
+      - hbbr
75
+    restart: unless-stopped
76
+
77
+  hbbr:
78
+    container_name: hbbr
79
+    ports:
80
+      - 21117:21117
81
+      - 21119:21119
82
+    image: rustdesk/rustdesk-server:latest
83
+    command: hbbr
84
+    volumes:
85
+      - ./hbbr:/root
86
+    networks:
87
+      - rustdesk-net
88
+    restart: unless-stopped
89
+```
90
+
91
+Edit line 16 to point to your relay server (the one listening on port 21117). You can also edit the volume lines (L18 and L33) if you need.
26 92
 
27 93
 (docker-compose credit goes to @lukebarone and @QuiGonLeong)
94
+
95
+## S6-overlay based images
96
+
97
+These images are build against `busybox:stable` with the addition of the binaries (both hbbr and hbbs) and [S6-overlay](https://github.com/just-containers/s6-overlay). They're available on [Docker hub](https://hub.docker.com/r/rustdesk/rustdesk-server-36/) with these tags:
98
+
99
+| architecture | version | image:tag |
100
+| --- | --- | --- |
101
+| multiarch | latest | `rustdesk/rustdesk-server-s6:latest` |
102
+| amd64 | latest | `rustdesk/rustdesk-server-s6:latest-amd64` |
103
+| i386 | latest | `rustdesk/rustdesk-server-s6:latest-i386` |
104
+| arm64v8 | latest | `rustdesk/rustdesk-server-s6:latest-arm64v8` |
105
+| armv7 | latest | `rustdesk/rustdesk-server-s6:latest-armv7` |
106
+| multiarch | 2 | `rustdesk/rustdesk-server-s6:2` |
107
+| amd64 | 2 | `rustdesk/rustdesk-server-s6:2-amd64` |
108
+| i386 | 2 | `rustdesk/rustdesk-server-s6:2-i386` |
109
+| arm64v8 | 2 | `rustdesk/rustdesk-server-s6:2-arm64v8` |
110
+| armv7 | 2 | `rustdesk/rustdesk-server-s6:2-armv7` |
111
+| multiarch | 2.0.0 | `rustdesk/rustdesk-server-s6:2.0.0` |
112
+| amd64 | 2.0.0 | `rustdesk/rustdesk-server-s6:2.0.0-amd64` |
113
+| i386 | 2.0.0 | `rustdesk/rustdesk-server-s6:2.0.0-i386` |
114
+| arm64v8 | 2.0.0 | `rustdesk/rustdesk-server-s6:2.0.0-arm64v8` |
115
+| armv7 | 2.0.0 | `rustdesk/rustdesk-server-s6:2.0.0-armv7` |
116
+
117
+You're strongly encuraged to use the `multiarch` image either with the `major version` or `latest` tag.
118
+
119
+The S6-overlay acts as a supervisor and keeps both process running, so with this image there's no need to have two separate running containers.
120
+
121
+You can start these images directly with `docker run` with this command:
122
+
123
+```bash
124
+docker run --name rustdesk-server \
125
+  -p 21115:21115 -p 21116:21116 -p 21116:21116/udp \
126
+  -p 21117:21117 -p 21118:21118 -p 21119:21119 \
127
+  -e "RELAY=rustdeskrelay.example.com" \
128
+  -e "ENCRYPTED_ONLY=1" \
129
+  -v "$PWD/data:/data" -d rustdesk/rustdesk-server-s6:latest
130
+```
131
+
132
+Or you can use a docker-compose file:
133
+
134
+```yaml
135
+version: '3'
136
+
137
+services:
138
+  rustdesk-server:
139
+    container_name: rustdesk-server
140
+    ports:
141
+      - 21115:21115
142
+      - 21116:21116
143
+      - 21116:21116/udp
144
+      - 21117:21117
145
+      - 21118:21118
146
+      - 21119:21119
147
+    image: rustdesk/rustdesk-server-s6:latest
148
+    environment:
149
+      - "RELAY=rustdesk.example.com:21117"
150
+      - "ENCRYPTED_ONLY=1"
151
+    volumes:
152
+      - ./data:/data
153
+    restart: unless-stopped
154
+```
155
+
156
+We use these environment variables:
157
+
158
+| variable | optional | description |
159
+| --- | --- | --- |
160
+| RELAY | no | the IP address/DNS name of the machine running this container |
161
+| ENCRYPTED_ONLY | yes | if set to **"1"** unencrypted connection will not be accepted |

+ 4 - 0
docker-classic/Dockerfile

@@ -0,0 +1,4 @@
1
+FROM ubuntu:20.04    
2
+COPY hbbs /usr/bin/hbbs    
3
+COPY hbbr /usr/bin/hbbr    
4
+WORKDIR /root