diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de3af6cf386723523401061601451beb3ec52943..dc8e7af655b624037d40cebe99fa805e015fa8e9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -build: +seahub: stage: build image: name: gcr.io/kaniko-project/executor:debug @@ -6,4 +6,13 @@ build: script: - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA} --destination $CI_REGISTRY_IMAGE:latest + - /kaniko/executor --context seahub/$CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/seahub/Dockerfile --destination $CI_REGISTRY_IMAGE:seahub-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA} --destination $CI_REGISTRY_IMAGE:seahub +server: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context server/$CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server/Dockerfile --destination $CI_REGISTRY_IMAGE:server-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA} --destination $CI_REGISTRY_IMAGE:server diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 5213b5e83dfd322a9b62f9015b61df7d17075d61..0000000000000000000000000000000000000000 --- a/Dockerfile +++ /dev/null @@ -1,59 +0,0 @@ -FROM ubuntu:18.04 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - python3 \ - python3-pip \ - python3-setuptools \ - wget - -RUN python3.6 -m pip install --upgrade pip && rm -r /root/.cache/pip - -RUN pip3 install \ - click \ - termcolor \ - colorlog \ - psycopg2-binary \ - django==1.11.29 \ - Pillow \ - pylibmc \ - captcha \ - jinja2 \ - sqlalchemy \ - psd-tools \ - django-pylibmc \ - django-simple-captcha \ - python3-ldap \ - && rm -r /root/.cache/pip - -# add entrypoints -ADD src/setenv.sh / -ADD src/docker-entrypoint.sh / - -# set environment variables for locale -ARG LANG=C.UTF-8 -ARG LANGUAGE=C.UTF-8 -ARG LC_ALL=C.UTF-8 - -# set environment variables for seafile -ARG ROOTPATH=/haiwen -ARG INSTALLPATH=$ROOTPATH/seafile-server-latest - -ENV CCNET_CONF_DIR=$ROOTPATH/ccnet -ENV SEAFILE_CENTRAL_CONF_DIR=$ROOTPATH/conf -ENV SEAFILE_CONF_DIR=$ROOTPATH/seafile-data - -ENV GC_AT_STARTUP=false - -# setup user environment -RUN addgroup --gid 1000 seafile && \ - adduser --gid 1000 --uid 1000 --system --shell /bin/bash --home $ROOTPATH seafile -USER seafile -VOLUME $SEAFILE_CONF_DIR - -RUN wget https://download.seadrive.org/seafile-server_8.0.5_x86-64.tar.gz -O /tmp/seafile-server.tar.gz && \ - tar -C /tmp/ -xzvf /tmp/seafile-server.tar.gz && \ - rm /tmp/seafile-server.tar.gz && \ - mv /tmp/seafile-server-* $INSTALLPATH - -ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/Makefile b/Makefile deleted file mode 100644 index 1949a53a90813eeb4dd4499fcd0ca9d00aa2a68c..0000000000000000000000000000000000000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -IMAGE := k8r.eu/justjanne/$(shell basename $(shell git remote get-url origin) .git) -TAGS := $(shell git describe --always --tags HEAD) - -.PHONY: build -build: - docker build --pull -t $(IMAGE):$(TAGS) . - docker tag $(IMAGE):$(TAGS) $(IMAGE):latest - @echo Successfully tagged $(IMAGE):$(TAGS) as latest - -.PHONY: push -push: build - docker push $(IMAGE):$(TAGS) - docker push $(IMAGE):latest - @echo Successfully pushed $(IMAGE):$(TAGS) as latest diff --git a/seahub/Dockerfile b/seahub/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7d6c2c5c6abec7d7fee74ad997fb90ad43967d85 --- /dev/null +++ b/seahub/Dockerfile @@ -0,0 +1,144 @@ +FROM ubuntu:18.04 + +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -y ssh \ + libevent-dev \ + libcurl4-openssl-dev \ + libglib2.0-dev \ + uuid-dev \ + intltool \ + libsqlite3-dev \ + libmysqlclient-dev \ + libarchive-dev \ + libtool \ + libjansson-dev \ + valac \ + libfuse-dev \ + cmake \ + re2c \ + flex \ + sqlite3 \ + python-pip \ + python-simplejson \ + git \ + libssl-dev \ + libldap2-dev \ + libonig-dev \ + vim \ + vim-scripts \ + wget \ + cmake \ + gcc \ + autoconf \ + automake \ + mysql-client \ + postgresql-client \ + libpq-dev \ + librados-dev \ + libxml2-dev \ + curl \ + telnet \ + netcat \ + unzip \ + netbase \ + ca-certificates \ + apt-transport-https \ + build-essential \ + libxslt1-dev \ + libffi-dev \ + libpcre3-dev \ + libz-dev \ + xz-utils \ + nginx \ + pkg-config \ + poppler-utils \ + libmemcached-dev +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - +RUN apt-get install -y nodejs +RUN apt-get install -y python3-pip python3 python3-dev +RUN python3 -m pip install --upgrade pip +RUN rm /usr/bin/python +RUN ln -s /usr/bin/python3 /usr/bin/python +RUN rm /usr/bin/pip +RUN ln -s /usr/local/bin/pip3 /usr/bin/pip +RUN pip install \ + python-cas \ + djangosaml2 \ + cffi \ + sqlalchemy \ + pymysql \ + pillow \ + pycryptodome \ + configparser \ + pylibmc \ + django-pylibmc \ + elasticsearch==5.5.0 \ + elasticsearch-dsl==5.4.0 \ + Django==2.2.14 \ + future \ + captcha \ + django-statici18n \ + django-post_office==3.3.0 \ + django-webpack_loader==0.7.0 \ + gunicorn \ + mysqlclient \ + django-picklefield==2.1.1 \ + openpyxl \ + qrcode \ + django-formtools \ + django-simple-captcha \ + djangorestframework==3.11.1 \ + python-dateutil \ + requests \ + pillow \ + pyjwt \ + pycryptodome \ + requests_oauthlib \ + mock \ + nose \ + exam \ + splinter \ + pytest \ + pytest-django \ + psycopg2 + +RUN mkdir /source +WORKDIR /source +RUN git clone https://github.com/haiwen/libevhtp.git +RUN git clone https://github.com/haiwen/libsearpc.git +RUN git clone --single-branch --branch=feat/postgres-support https://github.com/justjanne/seafile-server.git +RUN git clone --single-branch --branch=feat/postgres-support https://github.com/justjanne/seahub.git + +WORKDIR /source/libevhtp +RUN cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF . +RUN make +RUN make install +RUN ldconfig + +WORKDIR /source/libsearpc +RUN ./autogen.sh +RUN ./configure +RUN make +RUN make install +RUN ldconfig + +WORKDIR /source/seafile-server +RUN ./autogen.sh +RUN ./configure --disable-fuse +RUN make +RUN make install +RUN ldconfig + +WORKDIR /source/seahub/frontend +RUN npm install +RUN npm run build + +ADD entrypoint.sh / +WORKDIR /source/seahub + +ENV PYTHONPATH="/usr/local/lib/python3.6/site-packages/:/source/seahub/thirdpart:$PYTHONPATH" +ENV CCNET_CONF_DIR="/conf" +ENV SEAFILE_CONF_DIR="/tmp" +ENV SEAFILE_CENTRAL_CONF_DIR="/conf" + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/seahub/entrypoint.sh b/seahub/entrypoint.sh new file mode 100755 index 0000000000000000000000000000000000000000..b79b083ac80e1c66610390489c847323d695f71a --- /dev/null +++ b/seahub/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +python3 manage.py collectstatic +python3 manage.py migrate +python3 manage.py runserver 0.0.0.0:8000 diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..32035983070704121ff909f7ea4cb72977f304f5 --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,134 @@ +FROM ubuntu:18.04 + +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -y ssh \ + libevent-dev \ + libcurl4-openssl-dev \ + libglib2.0-dev \ + uuid-dev \ + intltool \ + libsqlite3-dev \ + libmysqlclient-dev \ + libarchive-dev \ + libtool \ + libjansson-dev \ + valac \ + libfuse-dev \ + cmake \ + re2c \ + flex \ + sqlite3 \ + python-pip \ + python-simplejson \ + git \ + libssl-dev \ + libldap2-dev \ + libonig-dev \ + vim \ + vim-scripts \ + wget \ + cmake \ + gcc \ + autoconf \ + automake \ + mysql-client \ + postgresql-client \ + libpq-dev \ + librados-dev \ + libxml2-dev \ + curl \ + telnet \ + netcat \ + unzip \ + netbase \ + ca-certificates \ + apt-transport-https \ + build-essential \ + libxslt1-dev \ + libffi-dev \ + libpcre3-dev \ + libz-dev \ + xz-utils \ + nginx \ + pkg-config \ + poppler-utils \ + libmemcached-dev +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - +RUN apt-get install -y nodejs +RUN apt-get install -y python3-pip python3 python3-dev +RUN python3 -m pip install --upgrade pip +RUN rm /usr/bin/python +RUN ln -s /usr/bin/python3 /usr/bin/python +RUN rm /usr/bin/pip +RUN ln -s /usr/local/bin/pip3 /usr/bin/pip +RUN pip install \ + python-cas \ + djangosaml2 \ + cffi \ + sqlalchemy \ + pymysql \ + pillow \ + pycryptodome \ + configparser \ + pylibmc \ + django-pylibmc \ + elasticsearch==5.5.0 \ + elasticsearch-dsl==5.4.0 \ + Django==2.2.14 \ + future \ + captcha \ + django-statici18n \ + django-post_office==3.3.0 \ + django-webpack_loader==0.7.0 \ + gunicorn \ + mysqlclient \ + django-picklefield==2.1.1 \ + openpyxl \ + qrcode \ + django-formtools \ + django-simple-captcha \ + djangorestframework==3.11.1 \ + python-dateutil \ + requests \ + pillow \ + pyjwt \ + pycryptodome \ + requests_oauthlib \ + mock \ + nose \ + exam \ + splinter \ + pytest \ + pytest-django + +RUN mkdir /source +WORKDIR /source +RUN git clone https://github.com/haiwen/libevhtp.git +RUN git clone https://github.com/haiwen/libsearpc.git +RUN git clone --single-branch --branch=feat/postgres-support https://github.com/justjanne/seafile-server.git + +WORKDIR /source/libevhtp +RUN cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF . +RUN make +RUN make install +RUN ldconfig + +WORKDIR /source/libsearpc +RUN ./autogen.sh +RUN ./configure +RUN make +RUN make install +RUN ldconfig + +WORKDIR /source/seafile-server +RUN ./autogen.sh +RUN ./configure --disable-fuse +RUN make +RUN make install +RUN ldconfig + +VOLUME /conf +VOLUME /data +VOLUME /tmp + +ENTRYPOINT ["seaf-server", "--central-config-dir", "/conf", "--seafdir", "/data", "--debug", "all", "--rpc-pipe-path", "/tmp", "--foreground", "--log", "-"] diff --git a/src/docker-entrypoint.sh b/src/docker-entrypoint.sh deleted file mode 100755 index c6e4a3eb18cb79ba57e0f66fc95f5b276f32ceb9..0000000000000000000000000000000000000000 --- a/src/docker-entrypoint.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -source setenv.sh - -if [[ "$GC_ON_STARTUP" = "true" ]]; then - $INSTALLPATH/seaf-gc.sh -fi - -$INSTALLPATH/seafile.sh start -$INSTALLPATH/seahub.sh start - -tail -f $ROOTPATH/logs/ccnet.log & -tail -f $ROOTPATH/logs/seahub.log & -tail -f $ROOTPATH/logs/seafile.log & -tail -f $ROOTPATH/logs/controller.log & - -maxretry=4 -retry=0 - -while [ "$retry" -le "$maxretry" ]; do - ps aux | grep seafile-controller | grep -v grep > /dev/null 2> /dev/null || { - retry=$(expr $retry + 1); - } - sleep 5 -done -echo "Seafile not running" -exit 1 diff --git a/src/setenv.sh b/src/setenv.sh deleted file mode 100755 index 615beb9bdbd15aaafd28c3aaa1b4aeb6a239a018..0000000000000000000000000000000000000000 --- a/src/setenv.sh +++ /dev/null @@ -1 +0,0 @@ -export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH