Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b7d8791ae9 | ||
![]() |
f993b3dc60 | ||
![]() |
8167148f00 | ||
![]() |
fe1b40da97 | ||
![]() |
3eaae31aae | ||
![]() |
5e5ee7f181 | ||
![]() |
f0a43458e3 |
@ -7,10 +7,13 @@ pipeline:
|
|||||||
docker:
|
docker:
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
repo: repo.shimun.net/shimun/seafile
|
repo: repo.shimun.net/shimun/seafile
|
||||||
|
tag: alpine-sq
|
||||||
registry: repo.shimun.net
|
registry: repo.shimun.net
|
||||||
storage_path: /drone/.docker
|
storage_path: /drone/.docker
|
||||||
secrets: ["docker_username", "docker_password"]
|
secrets: ["docker_username", "docker_password"]
|
||||||
storage_path: /drone/.docker
|
storage_path: /drone/.docker
|
||||||
cache_from: ["repo.shimun.net/shimun/seafile", "repo.shimun.net/shimun/seafile:nginx-deb", "repo.shimun.net/shimun/seafile:alpine"]
|
cache_from: ["repo.shimun.net/shimun/seafile", "repo.shimun.net/shimun/seafile:nginx-deb", "repo.shimun.net/shimun/seafile:alpine"]
|
||||||
use_cache: true
|
use_cache: true
|
||||||
|
experimental: true
|
||||||
|
squash: true
|
||||||
pull_image: false
|
pull_image: false
|
||||||
|
22
Dockerfile
22
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM nginx:mainline
|
FROM frolvlad/alpine-glibc
|
||||||
|
|
||||||
VOLUME /opt/seafile
|
VOLUME /opt/seafile
|
||||||
|
|
||||||
@ -6,11 +6,23 @@ EXPOSE 80 10001 12001 8000 8080 8082
|
|||||||
|
|
||||||
ENV SEAF=/opt/seafile
|
ENV SEAF=/opt/seafile
|
||||||
|
|
||||||
|
ENV INSTALLPATH=$SEAF/seafile-server-latest
|
||||||
|
|
||||||
|
ENV CCNET_CONF_DIR=$SEAF/ccnet
|
||||||
|
|
||||||
|
ENV SEAFILE_CONF_DIR=$SEAF/seafile-data
|
||||||
|
|
||||||
|
ENV SEAFILE_CENTRAL_CONF_DIR=$SEAF/conf
|
||||||
|
|
||||||
|
ENV PYTHONPATH=/usr/lib/python2.7/site-packages
|
||||||
|
|
||||||
COPY requirements.txt /tmp/requirements.txt
|
COPY requirements.txt /tmp/requirements.txt
|
||||||
|
|
||||||
RUN apt update && apt install locales -y && apt install -y --no-install-recommends procps openssl python2.7 sqlite3 python-mysqldb python-pil curl libjansson4 libfuse2 python-pip python-pip-whl python-setuptools \
|
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
|
||||||
&& pip install -r /tmp/requirements.txt && apt remove -y python-pip \
|
&& apk --no-cache add py-pip sqlite-dev py-mysqldb py-imaging py-pillow py-setuptools sqlite zlib curl bash openssl-dev libevent libselinux nginx \
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/requirements.txt
|
&& pip install -r /tmp/requirements.txt && apk --no-cache del py-pip \
|
||||||
|
&& rm -f /tmp/requirements.txt \
|
||||||
|
&& mkdir -p /run/nginx
|
||||||
|
|
||||||
COPY conf /opt/seafile/conf
|
COPY conf /opt/seafile/conf
|
||||||
COPY conf /etc/seafile
|
COPY conf /etc/seafile
|
||||||
@ -23,6 +35,8 @@ RUN ulimit -n 30000 && mkdir -p $SEAF/pids && \
|
|||||||
|
|
||||||
ENV SEAF_UPGRADE_INTERVAL=3
|
ENV SEAF_UPGRADE_INTERVAL=3
|
||||||
|
|
||||||
|
WORKDIR $SEAF
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/seafile-server"]
|
ENTRYPOINT ["/sbin/seafile-server"]
|
||||||
#Defaults to run-upgrade options include: run, run-upgrade, upgrade, stop, stop-upgrade
|
#Defaults to run-upgrade options include: run, run-upgrade, upgrade, stop, stop-upgrade
|
||||||
CMD ["run-upgrade"]
|
CMD ["run-upgrade"]
|
||||||
|
@ -78,9 +78,27 @@ def perform_upgrade_command(version,mysql=False,yes=True):
|
|||||||
cmd.append(script)
|
cmd.append(script)
|
||||||
call(["/bin/sh", "-c", ''.join(cmd)], stdout=sys.stdout, stdin=(None if yes else sys.stdin))
|
call(["/bin/sh", "-c", ''.join(cmd)], stdout=sys.stdout, stdin=(None if yes else sys.stdin))
|
||||||
|
|
||||||
def install_command(url):
|
def download(url, version):
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
if call(["/bin/sh", "-c", 'cd %s; curl %s | tar xzv' % (tmp, url)]) == 0:
|
filename = "server_%s.tar.gz" % version
|
||||||
|
pks = os.path.join(seaf_home, "pkg")
|
||||||
|
if not os.path.exists(pks):
|
||||||
|
os.mkdir(pks)
|
||||||
|
dest = os.path.join(pks, filename)
|
||||||
|
if os.path.exists(dest):
|
||||||
|
return dest
|
||||||
|
if call(["/bin/sh", "-c", 'curl %s --output %s/%s' % (url, tmp, filename)]) == 0:
|
||||||
|
shutil.move(os.path.join(tmp,filename), dest)
|
||||||
|
call(["/bin/chmod", "-w", dest])
|
||||||
|
return dest
|
||||||
|
else:
|
||||||
|
print("Download failed")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def install_command(url, version):
|
||||||
|
pkg = download(url, version)
|
||||||
|
tmp = tempfile.mkdtemp()
|
||||||
|
if pkg and call(["/bin/sh", "-c", 'cd %s; tar xzvf %s' % (tmp, pkg)]) == 0:
|
||||||
for f in os.listdir(tmp):
|
for f in os.listdir(tmp):
|
||||||
dest = os.path.join(seaf_home, os.path.basename(f))
|
dest = os.path.join(seaf_home, os.path.basename(f))
|
||||||
if len(re.findall(version_re, f)) > 0:
|
if len(re.findall(version_re, f)) > 0:
|
||||||
@ -95,7 +113,7 @@ def install_command(url):
|
|||||||
else: current = "0.0.0"
|
else: current = "0.0.0"
|
||||||
print("Upgrading from: %s -> %s" % (current, target_version))
|
print("Upgrading from: %s -> %s" % (current, target_version))
|
||||||
perform_upgrade_command(target_version,mysql=("SEAF_MYSQL" in os.environ and os.environ["SEAF_MYSQL"]))
|
perform_upgrade_command(target_version,mysql=("SEAF_MYSQL" in os.environ and os.environ["SEAF_MYSQL"]))
|
||||||
if os.exists(tmp) and len(os.listdir(tmp)) != 0:
|
if os.path.exists(tmp) and len(os.listdir(tmp)) != 0:
|
||||||
print("Failed to unpack update")
|
print("Failed to unpack update")
|
||||||
os.rmdir(tmp)
|
os.rmdir(tmp)
|
||||||
return 1
|
return 1
|
||||||
@ -118,7 +136,7 @@ def main_command(version="latest",page="https://www.seafile.com/en/download/"):
|
|||||||
return perform_upgrade_command(version)
|
return perform_upgrade_command(version)
|
||||||
if install:
|
if install:
|
||||||
print("Installing: %s" % version)
|
print("Installing: %s" % version)
|
||||||
sys.exit(install_command(install))
|
sys.exit(install_command(install, version))
|
||||||
else:
|
else:
|
||||||
print("Couldn't determine download for %s" % version)
|
print("Couldn't determine download for %s" % version)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user