diff --git a/CHANGELOG.md b/CHANGELOG.md
index e8a0627..dd9f18c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+### [1.0.1] - 2019/03/18
+- Add failsafe when importing Seafile's APT-key
+- Restrict production build to latest, majors, minors and revisions version, on-demand.
# [1.0.0] - 2019/03/15
- Release to Docker Hub
diff --git a/Dockerfile b/Dockerfile
index dc7a99f..830b31e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -30,12 +30,12 @@ COPY assets/supervisord.conf /.supervisord/
COPY assets/infinite-seaf-cli-start.sh /
COPY entrypoint.sh /
-# Install both seafile-cli and supervisord.
-RUN apt-key adv \
- --keyserver hkp://keyserver.ubuntu.com:80 \
- --recv-keys 8756C4F765C9AC3CB6B85D62379CE192D401AB61
-RUN apt-get update ;\
+# Safely import Seafile APT key, then install both seafile-cli and supervisord.
+COPY utils/build/import-seafile-apt-key.sh /
+RUN /bin/bash /import-seafile-apt-key.sh ;\
+ apt-get update ;\
apt-get install -o Dpkg::Options::="--force-confold" -y seafile-cli supervisor
+RUN rm -f /import-seafile-apt-key.sh
# Configure the user.
ENV UNAME=seafuser
diff --git a/README.md b/README.md
index c487633..80d8a25 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,25 @@
-[](https://gitlab.com/flwgns-docker/seafile-client/commits/1.0.0)
+[](https://gitlab.com/flwgns-docker/seafile-client/commits/1.0.1)
[](https://hub.docker.com/r/flowgunso/seafile-client)
# Available tags
-## Production stable release
-[`1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0),
-[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0),
+Weekly stable release are built every Monday at 6AM UTC+2.
+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.1),
+[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.1),
+[`1.0.1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.1),
+[`latest`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.1)
+(see tag/release [1.0.1](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.1))
+
+## Permanent stable releases.
[`1.0.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0),
-[`latest`](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))
-## Developmental releases
+## Developmental releases.
[`staging`](https://gitlab.com/flwgns-docker/seafile-client/tree/staging)
(see branch [staging](https://gitlab.com/flwgns-docker/seafile-client/tree/staging))
diff --git a/utils/build/import-seafile-apt-key.sh b/utils/build/import-seafile-apt-key.sh
new file mode 100644
index 0000000..4818945
--- /dev/null
+++ b/utils/build/import-seafile-apt-key.sh
@@ -0,0 +1,27 @@
+#!/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 .
+
+not_imported=true
+while $not_imported; do
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8756C4F765C9AC3CB6B85D62379CE192D401AB61
+ if [ $? -eq 0 ]; then
+ not_imported=false
+ else
+ sleep 5
+ fi
+done
\ No newline at end of file
diff --git a/utils/publish/production.sh b/utils/publish/production.sh
index 89eefc0..8c3e6fb 100755
--- a/utils/publish/production.sh
+++ b/utils/publish/production.sh
@@ -1,11 +1,41 @@
#!/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 .
+
# Restrict production build to tag matching MAJOR.MINOR.REVISION.
if ! [[ "$CI_COMMIT_TAG" =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo "Version number must match major.minor.revision!"
exit 1
fi
+# If no build indication was given, assume BUILD_LATEST.
+# Most likely, this will only cover builds triggered from tag pushes.
+if [ -z $BUILD_LATEST -o \
+ -z $BUILD_MAJOR -o \
+ -z $BUILD_MINOR -o \
+ -z $BUILD_REVISION ]; then
+ BUILD_LATEST=true
+fi
+
+# Cascade the builds by inheritance.
+if [ $BUILD_LATEST ]; then BUILD_MAJOR=true; BUILD_MINOR=true; BUILD_REVISION=true; fi
+if [ $BUILD_MAJOR ]; then BUILD_MINOR=true; BUILD_REVISION=true; fi
+if [ $BUILD_MINOR ]; then BUILD_REVISION=true; fi
+
# Define MAJOR, MINOR and REVISION version numbers.
MAJOR_NUMBER=$(echo "$CI_COMMIT_TAG" | awk -F \. {'print $1'})
MINOR_NUMBER=$(echo "$CI_COMMIT_TAG" | awk -F \. {'print $2'})
@@ -14,15 +44,15 @@ MAJOR=$MAJOR_NUMBER
MINOR=$MAJOR.$MINOR_NUMBER
REVISION=$MINOR.$REVISION_NUMBER
-# Build.
+# Always build with all tags, there's a single build anyway.
docker build \
-t $CI_REGISTRY_IMAGE:latest \
-t $CI_REGISTRY_IMAGE:$MAJOR \
-t $CI_REGISTRY_IMAGE:$MINOR \
-t $CI_REGISTRY_IMAGE:$REVISION .
-# And push.
-docker push $CI_REGISTRY_IMAGE:latest
-docker push $CI_REGISTRY_IMAGE:$MAJOR
-docker push $CI_REGISTRY_IMAGE:$MINOR
-docker push $CI_REGISTRY_IMAGE:$REVISION
\ No newline at end of file
+# Only push requested builds.
+if [ $BUILD_LATEST ]; then docker push $CI_REGISTRY_IMAGE:latest; fi
+if [ $BUILD_MAJOR ]; then docker push $CI_REGISTRY_IMAGE:$MAJOR; fi
+if [ $BUILD_MINOR ]; then docker push $CI_REGISTRY_IMAGE:$MINOR; fi
+if [ $BUILD_REVISION ]; then docker push $CI_REGISTRY_IMAGE:$REVISION; fi
\ No newline at end of file
diff --git a/utils/publish/staging.sh b/utils/publish/staging.sh
index 9d7735a..de1ba3c 100755
--- a/utils/publish/staging.sh
+++ b/utils/publish/staging.sh
@@ -1,5 +1,21 @@
#!/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 .
+
# Just build and push as staging.
docker build -t $CI_REGISTRY_IMAGE:staging .
docker push $CI_REGISTRY_IMAGE:staging
\ No newline at end of file