diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dc8e7af655b624037d40cebe99fa805e015fa8e9..33d2f9dde0e04173175660ffa2ed2d9248529086 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-seahub:
+server:
   stage: build
   image:
     name: gcr.io/kaniko-project/executor:debug
@@ -6,8 +6,8 @@ seahub:
   script:
     - mkdir -p /kaniko/.docker
     - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-    - /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:
+    - /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
+seahub:
   stage: build
   image:
     name: gcr.io/kaniko-project/executor:debug
@@ -15,4 +15,6 @@ server:
   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
+    - /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
+  needs:
+    - "server"
diff --git a/seahub/Dockerfile b/seahub/Dockerfile
index 7d6c2c5c6abec7d7fee74ad997fb90ad43967d85..59fdefa5094b0217d3eea0bfac54b53f5f4b31ad 100644
--- a/seahub/Dockerfile
+++ b/seahub/Dockerfile
@@ -1,144 +1,25 @@
-FROM ubuntu:18.04
+FROM seafile-server
 
-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 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 \
-    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 install --force
 RUN npm run build
 
 ADD entrypoint.sh /
 WORKDIR /source/seahub
 
-ENV PYTHONPATH="/usr/local/lib/python3.6/site-packages/:/source/seahub/thirdpart:$PYTHONPATH"
+ENV PYTHONPATH="/usr/local/lib/python3.10/site-packages/:/source/seahub/thirdpart:$PYTHONPATH"
 ENV CCNET_CONF_DIR="/conf"
 ENV SEAFILE_CONF_DIR="/tmp"
 ENV SEAFILE_CENTRAL_CONF_DIR="/conf"
 
+VOLUME /conf
+VOLUME /data
+VOLUME /tmp
+
 ENTRYPOINT ["/entrypoint.sh"]
diff --git a/seahub/entrypoint.sh b/seahub/entrypoint.sh
index b79b083ac80e1c66610390489c847323d695f71a..ee45252a1890c4536a6b6c3688af070c9eae0f36 100755
--- a/seahub/entrypoint.sh
+++ b/seahub/entrypoint.sh
@@ -2,4 +2,5 @@
 
 python3 manage.py collectstatic
 python3 manage.py migrate
+python3 manage.py migrate_base_filecomment
 python3 manage.py runserver 0.0.0.0:8000
diff --git a/server/Dockerfile b/server/Dockerfile
index 32035983070704121ff909f7ea4cb72977f304f5..062ac87c278814194707e84c932c4180637e7cc6 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -1,105 +1,78 @@
-FROM ubuntu:18.04
+FROM ubuntu:22.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 \
+RUN apt-get install -y \
+    apt-transport-https \
+    autoconf \
+    automake \
     cmake \
-    re2c  \
+    build-essential \
+    curl  \
     flex  \
-    sqlite3  \
-    python-pip  \
-    python-simplejson \
     git  \
-    libssl-dev \
+    intltool  \
+    libarchive-dev  \
+    libcurl4-openssl-dev  \
+    libevent-dev  \
+    libffi-dev \
+    libfuse-dev \
+    libglib2.0-dev  \
+    libjansson-dev \
     libldap2-dev \
+    libmemcached-dev \
+    libmysqlclient-dev  \
     libonig-dev  \
-    vim \
-    vim-scripts  \
-    wget  \
-    cmake  \
-    gcc  \
-    autoconf \
-    automake  \
-    mysql-client \
-    postgresql-client \
+    libpcre3-dev \
     libpq-dev \
     librados-dev  \
+    libsqlite3-dev  \
+    libssl-dev \
+    libtool \
     libxml2-dev  \
-    curl  \
-    telnet \
-    netcat  \
-    unzip  \
-    netbase \
-    ca-certificates \
-    apt-transport-https \
-    build-essential \
     libxslt1-dev \
-    libffi-dev \
-    libpcre3-dev \
     libz-dev  \
-    xz-utils  \
+    mysql-client \
+    netbase \
+    netcat  \
     nginx  \
     pkg-config  \
-    poppler-utils  \
-    libmemcached-dev
-RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
-RUN apt-get install -y nodejs
+    postgresql-client \
+    python-pip  \
+    re2c  \
+    sqlite3  \
+    unzip  \
+    uuid-dev  \
+    valac  \
+    xz-utils
 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
+  Django==3.2.6 \
+  future \
+  captcha \
+  django-statici18n \
+  django-webpack_loader==0.7.0 \
+  gunicorn \
+  mysqlclient \
+  psycopg2 \
+  django-picklefield==2.1.1 \
+  openpyxl \
+  qrcode \
+  django-formtools==2.3 \
+  django-simple-captcha \
+  djangorestframework==3.11.1 \
+  python-dateutil \
+  requests \
+  pillow \
+  pyjwt==2.1.* \
+  pycryptodome==3.12.0 \
+  requests_oauthlib \
+  chardet \
+  python-cas \
+  djangosaml2==0.20.0 \
+  pysaml2==6.5.1 \
+  cffi
 
 RUN mkdir /source
 WORKDIR /source