Initialize seafile client during container start

This commit is contained in:
2023-09-16 01:27:46 -07:00
parent 9f6c417147
commit 7f39e0f271
10 changed files with 150 additions and 113 deletions

View File

@@ -1,42 +1,46 @@
# docker-seafile-client
Runs a seafile client in docker with possibility to sync seafile repositories.
Docker image for Seafile terminal client.
## Docker-compose example:
### Docker-compose example:
```yaml
version: '3'
services:
seafile-client:
restart: always
image: snegov/seafile-client
environment:
- LIBRARY_ID=<your-library-id-here>
- SERVER_HOST=<server-host>
- USERNAME=<username>
- PASSWORD=<password>
- SEAFILE_UID=<your_uid>
- SEAFILE_GID=<your_gid>
hostname: docker-seafile-client
- LIBRARY_ID="79867cbf-2944-488d-9105-852463ecdf9e:my_library"
- SERVER_HOST=seafile.example.com
- USERNAME=user
- PASSWORD=password
- SEAFILE_UID=1000
- SEAFILE_GID=100
hostname: dsc
volumes:
- seafile-data:/seafile-client/seafile-data
- <host-volume-path>:/data
- /home/johndow/seafile:/dsc/seafile
- sync-data:/dsc/seafile-data
container_name: seafile-client
volumes:
seafile-data:
sync-data:
```
Library id could be found from "My Libraries" page in Seafile webUI - link to each library contains library ID in it.
### Environment variables:
- `LIBRARY_ID` - library to sync, ID or name. Multiple libraries could be separated by colon `:`.
- `SERVER_HOST` - hostname of your Seafile server, eg: `seafile.example.com`. If you're using non-standard port, you can specify it here, eg: `seafile.example.com:8080`.
- `USERNAME`/ `PASSWORD` - credentials to access Seafile server.
- `SEAFILE_UID` / `SEAFILE_GID` - UID/GID of user inside container. You can use it to set permissions on synced files. Default values are `1000`/`1000`.
Inside container libraries' content will be put in `/data` directory, so map your host directory to it.
### Volumes:
- `/dsc/seafile-data` Seafile client data directory (sync status, etc).
- `/dsc/seafile` Seafile libraries content.
`hostname` parameter in docker-compose will set client name in Seafile's "Linked devices" admin page. Resulting name will be prefixed by "terminal-".
Also you could check [docker-compose example](docker-compose.example.yml).
### Some notes
`LIBRARY_ID` could be library ID or library name. Library ID is a 36-character string, which is a part of URI when you open library in webUI. Library name is a name you gave to library when you created it.
Libraries will be synced in subdirectories of `/dsc/seafile` directory inside container. You can mount it to host directory to access files.
`hostname` parameter is optional, but it's recommended to set it to some unique value, it will be shown in Seafile webUI as client name (`terminal-dsc` in given example).
`sync-data` volume is optional too, but it's recommended to use it. Otherwise, sync status will be lost when container is recreated.
## Environment variables:
- `LIBRARY_ID=<your-library-id-here>` Library to sync, ID or name; multiple libraries could be separated by colon `:`.
- `SERVER_HOST=<server-host>` Hostname of your seafile server, eg: `seafile.example.com`. If you're using non-standart port, specify it here, eg: `seafile.example.com:8080`.
- `USERNAME=<username>` Seafile account username.
- `PASSWORD=<password>` Seafile account password.
- `SEAFILE_UID=<uid>` Downloaded files will have this uid.
- `SEAFILE_GID=<gid>` Downloaded files will have this gid.