Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 681b11bbc1 | |||
| 310eb9028c | |||
| 4dcac70520 | |||
| 6eadca4041 | |||
| 8a0b1abfe7 | |||
| a7ef878490 |
11
.github/workflows/docker-publish.yml
vendored
11
.github/workflows/docker-publish.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
needs: test
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -42,3 +42,12 @@ jobs:
|
||||
tag_with_ref: true
|
||||
add_git_labels: true
|
||||
push: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
|
||||
- uses: docker/build-push-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
repository: snegov/seafile-client
|
||||
tags: latest
|
||||
add_git_labels: true
|
||||
push: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
FROM python:3-slim
|
||||
|
||||
RUN apt-get update && apt-get install gnupg curl -y && rm -rf /var/lib/apt/lists/*
|
||||
RUN curl https://linux-clients.seafile.com/seafile.key | apt-key add - && \
|
||||
echo 'deb [arch=amd64] http://linux-clients.seafile.com/seafile-deb/buster/ stable main' > /etc/apt/sources.list.d/seafile.list && \
|
||||
RUN curl https://linux-clients.seafile.com/seafile.asc | apt-key add - && \
|
||||
echo 'deb [arch=amd64] https://linux-clients.seafile.com/seafile-deb/buster/ stable main' > /etc/apt/sources.list.d/seafile.list && \
|
||||
apt-get update -y && \
|
||||
apt-get install -y seafile-cli procps grep && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
@@ -20,4 +20,6 @@ RUN chmod +x /seafile-client/start.py && \
|
||||
chown seafile:seafile -R /seafile-client && \
|
||||
su - seafile -c "seaf-cli init -d /seafile-client"
|
||||
|
||||
VOLUME /seafile-client/seafile-data
|
||||
|
||||
CMD ["./start.py"]
|
||||
|
||||
35
README.md
35
README.md
@@ -1,33 +1,42 @@
|
||||
# docker-seafile-client
|
||||
Run a seafile client inside docker witch can sync files from seafile repositories
|
||||
|
||||
See docker-compose how to use.
|
||||
Runs a seafile client in docker with possibility to sync seafile repositories.
|
||||
|
||||
## Docker-compose example:
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
seafile-client:
|
||||
restart: always
|
||||
image: snegov/seafile-client
|
||||
container_name: seafile-client
|
||||
environment:
|
||||
- LIBRARY_ID=<your-library-id-here>
|
||||
- SERVER_HOST=<server-host>
|
||||
- USERNAME=<username>
|
||||
- PASSWORD=<password>
|
||||
- DATA_DIR=<directory-path-to-sync>
|
||||
- SEAFILE_UID=<your_uid>
|
||||
- SEAFILE_GID=<your_gid>
|
||||
hostname: docker-seafile-client
|
||||
volumes:
|
||||
- <host-volume-path>:<directory-path-to-sync>
|
||||
- seafile-data:/seafile-client/seafile-data
|
||||
- <host-volume-path>:/data
|
||||
|
||||
volumes:
|
||||
seafile-data:
|
||||
```
|
||||
|
||||
Library id could be found from "My Libraries" page in Seafile webUI - link to each library contains library ID in it.
|
||||
|
||||
Inside container libraries' content will be put in `/data` directory, so map your host directory to it.
|
||||
|
||||
`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).
|
||||
|
||||
## Environment variables:
|
||||
- `LIBRARY_ID=<your-library-id-here>` ID of library to sync; 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
|
||||
- `DATA_DIR=<directory-path-to-sync>` The path where to put the files
|
||||
- `SEAFILE_UID=<uid>` Downloaded files will have this uid
|
||||
- `SEAFILE_GID=<gid>` Downloaded files will have this gid
|
||||
- `LIBRARY_ID=<your-library-id-here>` ID of library to sync; 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.
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
seafile-client:
|
||||
restart: always
|
||||
image: snegov/seafile-client
|
||||
container_name: seafile-client
|
||||
environment:
|
||||
- LIBRARY_ID=<your-library-id-here>
|
||||
- SERVER_HOST=<server-host>
|
||||
- USERNAME=<username>
|
||||
- PASSWORD=<password>
|
||||
- DATA_DIR=<directory-path-to-sync>
|
||||
- SEAFILE_UID=<your_uid>
|
||||
- SEAFILE_GID=<your_gid>
|
||||
- LIBRARY_ID="79867cbf-2944-488d-9105-859463ecdf9e:8078e3ff-b2a0-450a-b4dd-c1ed9ef18294"
|
||||
- SERVER_HOST=seafile.example.com
|
||||
- USERNAME=user
|
||||
- PASSWORD=password
|
||||
- SEAFILE_UID=1000
|
||||
- SEAFILE_GID=100
|
||||
hostname: docker-seafcli
|
||||
volumes:
|
||||
- <host-volume-path>:<directory-path-to-sync>
|
||||
- seafile-data:/seafile-client/seafile-data
|
||||
- /home/johndow/seafile:/data
|
||||
|
||||
|
||||
volumes:
|
||||
seafile-data:
|
||||
|
||||
6
start.py
6
start.py
@@ -11,9 +11,9 @@ from seafile_client.misc import setup_uid, create_dir
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--uid", default=os.getenv("SEAFILE_UID"), type=int)
|
||||
parser.add_argument("--gid", default=os.getenv("SEAFILE_GID"), type=int)
|
||||
parser.add_argument("--data-dir", default=os.getenv("DATA_DIR"))
|
||||
parser.add_argument("--uid", default=os.getenv("SEAFILE_UID", default=1000), type=int)
|
||||
parser.add_argument("--gid", default=os.getenv("SEAFILE_GID", default=100), type=int)
|
||||
parser.add_argument("--data-dir", default=os.getenv("DATA_DIR", default="/data"))
|
||||
parser.add_argument("--host", default=os.getenv("SERVER_HOST"))
|
||||
parser.add_argument("--username", default=os.getenv("USERNAME"))
|
||||
parser.add_argument("--password", default=os.getenv("PASSWORD"))
|
||||
|
||||
Reference in New Issue
Block a user