Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker-compose support and update docker-compose illustrate #52

Merged
merged 5 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
- [功能](#功能)
- [服务器](#服务器)
- [独立服务器](#独立服务器)
- [Docker](#docker)
- [使用Docker容器部署服务器](#使用docker容器部署服务器)
- [Docker](#docker)
- [Docker Compose](#docker-compose)
- [客户端内置服务器](#客户端内置服务器)
- [WebDAV服务器](#webdav服务器)
- [客户端](#客户端)
Expand Down Expand Up @@ -53,23 +55,56 @@ dotnet /path/to/SyncClipboard.Server.dll --contentRoot ./
- http使用明文传输(包括本软件用于认证使用的基于Basic Auth的账号密码),在公网部署考虑使用反向代理工具配置SSL
- 内置服务器并不是WebDAV实现

#### Docker
你也可以使用Docker轻松部署服务器
#### 使用Docker容器部署服务器

在宿主机中拷贝一份服务器配置文件[appsettings.json](https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/appsettings.json)

```
mkdir syncclipboard-server && cd syncclipboard-server
curl -sL https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/appsettings.json > appsettings.json
```

根据你的需求在配置文件中修改用户名、密码

##### Docker

执行下边的命令,注意将命令行中的`/path/to/appsettings.json`修改为宿主机中`appsettings.json`的实际路径

```
docker run -d \
--name=syncclipboard-server \
-p 5033:5033 \
-v /path/to/appsettings.json:/app/appsettings.json \
--restart unless-stopped \
jericx/syncclipboard-server:latest
```
如需修改用户名和密码,请参考[jericx/syncclipboard-server](https://hub.docker.com/r/jericx/syncclipboard-server)

##### Docker Compose

在宿主机中拷贝一份[docker-compose.yml](https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/docker-compose.yml)

```
curl -sL https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/docker-compose.yml > docker-compose.yml
```

将`docker-compose.yml`文件中的`/path/to/appsettings.json`修改为宿主机中`appsettings.json`的实际路径,然后执行

```
docker compose up -d
```

注意:
- 服务器和容器相关文件储存在`src/SyncClipboard.Server`目录中,命令行无法下载时可以手动下载
- Docker镜像的托管地址是[Docker Hub/jericx/syncclipboard-server](https://hub.docker.com/r/jericx/syncclipboard-server)

### 客户端内置服务器

桌面客户端(Windows/Linux/macOS)内置了服务器,可以使用可视界面配置,注意事项同上

### WebDAV服务器
可以使用支持WebDAV协议的网盘作为服务器
测试过的服务器:

- [x] [Nextcloud](https://nextcloud.com/)
- [x] [坚果云](https://www.jianguoyun.com/)
- [x] [AList](https://alist.nn.ci/)
Expand Down Expand Up @@ -202,4 +237,4 @@ PUT /SyncClipboard.json
[FluentAvalonia](https://github.com/amwx/FluentAvalonia)
[Vanara](https://github.com/dahall/Vanara)
[Tmds.DBus](https://github.com/tmds/Tmds.DBus)
[SharpHook](https://github.com/TolikPylypchuk/SharpHook)
[SharpHook](https://github.com/TolikPylypchuk/SharpHook)
40 changes: 36 additions & 4 deletions docs/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
- [Features](#features)
- [Server](#server)
- [Standalone Server](#standalone-server)
- [Docker](#docker)
- [Docker Container](#docker-container)
- [Docker](#docker)
- [Docker Compose](#docker-compose)
- [Desktop Client Built-in Server](#desktop-client-built-in-server)
- [WebDAV Server](#webdav-server)
- [Client](#client)
Expand Down Expand Up @@ -54,16 +56,46 @@ Notes:
- Address to fill in client is `http://ip(or domain name):port`, nothing can be omitted.
- Http is not encrypted, including username and password. Maybe a https reverse proxy is needed on public network.

#### Docker
Deploying server with docker is easy.
#### Docker Container

Copy a server config file [appsettings.json](https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/appsettings.json) first.

```
mkdir syncclipboard-server && cd syncclipboard-server
curl -sL https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/appsettings.json > appsettings.json
```
Change your own username and password in `appsettings.json`.

##### Docker

Run the following command. Remember to change the `/path/to/appsettings.json` to your newly copied `appsettings.json`'s path.

```
docker run -d \
--name=syncclipboard-server \
-p 5033:5033 \
-v /path/to/appsettings.json:/app/appsettings.json \
--restart unless-stopped \
jericx/syncclipboard-server:latest
```
If you want to change username or password, please refer to [jericx/syncclipboard-server](https://hub.docker.com/r/jericx/syncclipboard-server)

##### Docker Compose

Copy a [docker-compose.yml](https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/docker-compose.yml) file.

```
curl -sL https://github.com/Jeric-X/SyncClipboard/raw/master/src/SyncClipboard.Server/docker-compose.yml > docker-compose.yml
```

Change the `/path/to/appsettings.json` in `docker-compose.yml` to your newly copied `appsettings.json`'s path, then run

```
docker compose up -d
```

Notes:
- Server related files are under `src/SyncClipboard.Server` directory. You can download them manually.
- Docker image is hosted on [Docker Hub/jericx/syncclipboard-server](https://hub.docker.com/r/jericx/syncclipboard-server).

### Desktop Client Built-in Server
Desktop client (Windows/Linux/macOS) has a built-in server, basically the same as standalone server but can be configured with GUI.
Expand Down
10 changes: 10 additions & 0 deletions src/SyncClipboard.Server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
syncclipboard-server:
image: jericx/syncclipboard-server:latest
container_name: syncclipboard-server
restart: unless-stopped
ports:
- "5033:5033" # Update this if you have changed the port in appsettings.json
volumes:
- /path/to/appsettings.json:/app/appsettings.json