Merge branch 'staging'
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
## [1.1.0] - 2019/04/09
|
||||
- The container now actually use the UID/GID provided to it:
|
||||
The container entrypoint is run with root, then another entrypoint is run by the container's user, seafuser, to run the Seafile client.
|
||||
|
||||
### [1.0.6] - 2019/03/25
|
||||
- More minor fixes from v1.0.4
|
||||
### [1.0.5] - 2019/03/25
|
||||
|
||||
31
Dockerfile
31
Dockerfile
@@ -19,16 +19,8 @@ FROM debian:jessie
|
||||
# Prevent the packages installation to halt.
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# Prepare the directories.
|
||||
RUN mkdir /.seafile ;\
|
||||
mkdir /.supervisord ;\
|
||||
mkdir /volume
|
||||
|
||||
# Put the core functionalities into the image.
|
||||
# Copy over the seafile repository.
|
||||
COPY assets/seafile.list /etc/apt/sources.list.d/
|
||||
COPY assets/supervisord.conf /.supervisord/
|
||||
COPY assets/infinite-seaf-cli-start.sh /
|
||||
COPY entrypoint.sh /
|
||||
|
||||
# Safely import Seafile APT key, then install both seafile-cli and supervisord.
|
||||
COPY utils/build/import-seafile-apt-key.sh /
|
||||
@@ -37,17 +29,20 @@ RUN /bin/bash /import-seafile-apt-key.sh ;\
|
||||
apt-get install -o Dpkg::Options::="--force-confold" -y seafile-cli supervisor
|
||||
RUN rm -f /import-seafile-apt-key.sh
|
||||
|
||||
# Configure the user.
|
||||
# Create the seafile client user.
|
||||
ENV UNAME=seafuser
|
||||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
RUN groupadd -g $GID -o $UNAME ;\
|
||||
useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ;\
|
||||
chown $UID.$GID -R /.seafile ;\
|
||||
chown $UID.$GID -R /.supervisord ;\
|
||||
chown $UID.$GID -R /volume ;\
|
||||
chown $UID.$GID /entrypoint.sh ;\
|
||||
chown $UID.$GID /infinite-seaf-cli-start.sh
|
||||
USER $UNAME
|
||||
useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
# Copy over the Docker entrypoint.
|
||||
COPY assets/docker-entrypoint.sh /entrypoint.sh
|
||||
|
||||
# Copy over the required files for Seafile/SupervisorD.
|
||||
COPY assets/supervisord.conf /home/seafuser/
|
||||
COPY assets/infinite-seaf-cli-start.sh /home/seafuser/
|
||||
COPY assets/seafile-entrypoint.sh /home/seafuser/entrypoint.sh
|
||||
RUN mkdir /volume
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
|
||||
25
README.md
25
README.md
@@ -1,4 +1,4 @@
|
||||
[](https://gitlab.com/flwgns-docker/seafile-client/commits/1.0.6)
|
||||
[](https://gitlab.com/flwgns-docker/seafile-client/commits/1.1.0)
|
||||
[](https://hub.docker.com/r/flowgunso/seafile-client)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
[](https://gitlab.com/flwgns-docker/seafile-client/)
|
||||
@@ -11,24 +11,25 @@ Permanent stable releases will not be built again.
|
||||
You can rely on the weekly stable releases. They are stable.
|
||||
|
||||
## Weekly stable releases.
|
||||
[`1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6),
|
||||
[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6),
|
||||
[`1.0.6`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6),
|
||||
[`latest`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6)
|
||||
(see tag/release [1.0.6](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6))
|
||||
[`1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0),
|
||||
[`1.1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0),
|
||||
[`1.1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0),
|
||||
[`latest`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0)
|
||||
(see tag/release [1.1.0](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0))
|
||||
|
||||
## Permanent stable releases.
|
||||
[`1.0.3`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3)
|
||||
(see tag/release [1.0.3](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3))
|
||||
[`1.0.2`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2)
|
||||
(see tag/release [1.0.2](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2))
|
||||
[`1.0.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0)
|
||||
(see tag/release [1.0.0](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0))
|
||||
None at the moment.
|
||||
|
||||
## Developmental releases.
|
||||
[`staging`](https://gitlab.com/flwgns-docker/seafile-client/tree/staging)
|
||||
(see branch [staging](https://gitlab.com/flwgns-docker/seafile-client/tree/staging))
|
||||
|
||||
## Obsolete releases.
|
||||
[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6) and it's revision
|
||||
[`1.0.6`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6),
|
||||
[`1.0.3`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3),
|
||||
[`1.0.2`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2),
|
||||
[`1.0.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0) are now obsolete.
|
||||
|
||||
# Purpose
|
||||
Docker Seafile Client allow you to sync a Seafile library within a container.
|
||||
|
||||
55
assets/docker-entrypoint.sh
Normal file
55
assets/docker-entrypoint.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Docker Seafile client, help you mount a Seafile library as a volume.
|
||||
# Copyright (C) 2019, flow.gunso@gmail.com
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Check mandatory Seafile configuration have been properly set.
|
||||
if [ -z $SEAF_SERVER_URL ]; then echo "The \$SEAF_SERVER_URL was not defined. Stopping container..."; exit 1; fi
|
||||
if [ -z $SEAF_USERNAME ]; then echo "The \$SEAF_USERNAME was not defined. Stopping container..."; exit 1; fi
|
||||
if [ -z $SEAF_PASSWORD ]; then echo "The \$SEAF_PASSWORD was not defined. Stopping container..."; exit 1; fi
|
||||
if [ -z $SEAF_LIBRARY_UUID ]; then echo "The \$SEAF_LIBRARY_UUID was not defined. Stopping container..."; exit 1; fi
|
||||
|
||||
# Update the user ID, if the $UID changed.
|
||||
if [ "$UID" != "1000" ]; then
|
||||
usermod -u $UID $UNAME
|
||||
# What if the $UID already exists ?
|
||||
fi
|
||||
|
||||
# Change the group, if the $GID changed.
|
||||
if [ "$GID" != "1000" ]; then
|
||||
getent group | grep ":$GID:" >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
usermod -g $GID -G 1000 $UNAME
|
||||
else
|
||||
groupmod -g $GID $UNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set the files ownership.
|
||||
chown $UID.$GID -R /home/seafuser/supervisord.conf
|
||||
chown $UID.$GID -R /home/seafuser/infinite-seaf-cli-start.sh
|
||||
chown $UID.$GID -R /home/seafuser/entrypoint.sh
|
||||
chown $UID.$GID -R /volume
|
||||
|
||||
# Run the Seafile client as the container user.
|
||||
su - $UNAME << EO
|
||||
export SEAF_SERVER_URL=$SEAF_SERVER_URL
|
||||
export SEAF_USERNAME=$SEAF_USERNAME
|
||||
export SEAF_PASSWORD=$SEAF_PASSWORD
|
||||
export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID
|
||||
export UNAME=$UNAME
|
||||
/bin/bash /home/seafuser/entrypoint.sh
|
||||
EO
|
||||
@@ -16,8 +16,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
/bin/sleep 10
|
||||
set -x
|
||||
|
||||
sleep 10
|
||||
while true; do
|
||||
/usr/bin/seaf-cli start
|
||||
/bin/sleep 3600
|
||||
sleep 3600
|
||||
done
|
||||
@@ -16,26 +16,27 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Check mandatory Seafile configuration have been properly set.
|
||||
if [ -z $SEAF_SERVER_URL ]; then echo "The \$SEAF_SERVER_URL was not defined. Stopping container..."; echo 1; fi
|
||||
if [ -z $SEAF_USERNAME ]; then echo "The \$SEAF_USERNAME was not defined. Stopping container..."; echo 1; fi
|
||||
if [ -z $SEAF_PASSWORD ]; then echo "The \$SEAF_PASSWORD was not defined. Stopping container..."; echo 1; fi
|
||||
if [ -z $SEAF_LIBRARY_UUID ]; then echo "The \$SEAF_LIBRARY_UUID was not defined. Stopping container..."; echo 1; fi
|
||||
|
||||
# Define variable shortcuts for readability purposes.
|
||||
seafile_ini=~/.ccnet/seafile.ini
|
||||
seafile_sock=/.seafile/seafile-data/seafile.sock
|
||||
supervisord_conf=/.supervisord/supervisord.conf
|
||||
supervisord_pid=/.supervisord/supervisord.pid
|
||||
supervisord_log=/.supervisord/supervisord.log
|
||||
seafile_sock=~/.seafile/seafile-data/seafile.sock
|
||||
supervisord_conf=~/supervisord.conf
|
||||
supervisord_pid=~/.supervisord/supervisord.pid
|
||||
supervisord_log=~/.supervisord/supervisord.log
|
||||
|
||||
# Safely initialize Seafile.
|
||||
/usr/bin/seaf-cli init -d /.seafile
|
||||
# Prepare the directories.
|
||||
mkdir ~/.seafile
|
||||
mkdir ~/.supervisord
|
||||
|
||||
# Safely initialise the Seafile client.
|
||||
/usr/bin/seaf-cli init -d ~/.seafile
|
||||
while [ ! -f $seafile_ini ]; do sleep 1; done
|
||||
|
||||
# Safely start the Seafile daemon.
|
||||
/usr/bin/seaf-cli start
|
||||
while [ ! -S $seafile_sock ]; do sleep 1; done
|
||||
|
||||
# Start the synchronisation.
|
||||
/usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume
|
||||
|
||||
# Start the supervisord.
|
||||
/usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log
|
||||
@@ -20,11 +20,11 @@ nodaemon=true
|
||||
|
||||
# Manage the Seafile daemon.
|
||||
[unix_http_socket]
|
||||
file=/seafile/seafile-data/seafile.sock
|
||||
file=~/.seafile/seafile-data/seafile.sock
|
||||
|
||||
# Manage the infinite `seaf-cli start`.
|
||||
[program:seaf-cli-start-loop]
|
||||
command=/bin/bash /infinite-seaf-cli-start.sh
|
||||
command=/bin/bash /home/seafuser/infinite-seaf-cli-start.sh
|
||||
process_name=%(program_name)s
|
||||
numprocs=1
|
||||
autostart=true
|
||||
autostart=true
|
||||
|
||||
Reference in New Issue
Block a user