From 3cab25d944e513f4ba34bfe59fd1fd713cb7d610 Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Sun, 28 Jul 2024 21:51:27 +0200 Subject: [PATCH] build seafile from scratch --- seafile-server/Dockerfile | 25 ++++++++++++++----------- seahub-media/Dockerfile | 20 ++++++++++++-------- seahub/Dockerfile | 30 +++++++++++++++++------------- 3 files changed, 43 insertions(+), 32 deletions(-) diff --git a/seafile-server/Dockerfile b/seafile-server/Dockerfile index 3b661af..ecb25a1 100644 --- a/seafile-server/Dockerfile +++ b/seafile-server/Dockerfile @@ -1,19 +1,22 @@ -FROM alpine:3.20.2 AS get +FROM ubuntu:jammy@sha256:340d9b015b194dc6e2a13938944e0d016e57b9679963fdeb9ce021daac430221 AS build -RUN apk add --no-cache wget +RUN apt-get update && \ +DEBIAN_FRONTEND=noninteractive apt-get install -y \ +wget ENV SEAFILE_VERSION=11.0.9 -RUN cd /tmp && \ - wget https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz?nocache=$(date +%s) -O seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \ - tar -zxvf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \ - rm -f seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz +WORKDIR /tmp +RUN wget https://raw.githubusercontent.com/haiwen/seafile-docker/master/build/seafile-build.sh +RUN wget https://raw.githubusercontent.com/haiwen/seafile-docker/master/build/seafile-build.py +RUN chmod +x ./seafile-build.sh +RUN ./seafile-build.sh ${SEAFILE_VERSION} FROM alpine:3.20.2 AS clean ENV SEAFILE_VERSION=11.0.9 -COPY --from=get /tmp/seafile-server-${SEAFILE_VERSION} /tmp/seafile-server-${SEAFILE_VERSION} +COPY --from=build /tmp/seafile-server-${SEAFILE_VERSION} /tmp/seafile-server-${SEAFILE_VERSION} RUN rm -rf /tmp/seafile-server-${SEAFILE_VERSION}/seahub @@ -65,10 +68,10 @@ python3 \ COPY --from=pip /pip-deps /usr/local/lib/python3.10/dist-packages COPY --from=clean /tmp/seafile-server-${SEAFILE_VERSION} /opt/seafile/seafile-server-${SEAFILE_VERSION} -COPY --from=get /tmp/seafile-server-${SEAFILE_VERSION}/seahub/thirdpart/seafobj /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/thirdpart/seafobj -COPY --from=get /tmp/seafile-server-${SEAFILE_VERSION}/seahub/scripts /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/thirdpart/scripts -COPY --from=get /tmp/seafile-server-${SEAFILE_VERSION}/seahub/media/avatars /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/media/avatars -COPY --from=get /tmp/seafile-server-${SEAFILE_VERSION}/seahub/seahub/settings.py /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/seahub/settings.py +COPY --from=build /tmp/seafile-server-${SEAFILE_VERSION}/seahub/thirdpart/seafobj /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/thirdpart/seafobj +COPY --from=build /tmp/seafile-server-${SEAFILE_VERSION}/seahub/scripts /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/thirdpart/scripts +COPY --from=build /tmp/seafile-server-${SEAFILE_VERSION}/seahub/media/avatars /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/media/avatars +COPY --from=build /tmp/seafile-server-${SEAFILE_VERSION}/seahub/seahub/settings.py /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/seahub/settings.py COPY scripts /scripts RUN chmod u+x /scripts/* diff --git a/seahub-media/Dockerfile b/seahub-media/Dockerfile index e53e8c1..8f98eb8 100644 --- a/seahub-media/Dockerfile +++ b/seahub-media/Dockerfile @@ -1,13 +1,17 @@ -FROM alpine:3.20.2 AS get +FROM ubuntu:jammy@sha256:340d9b015b194dc6e2a13938944e0d016e57b9679963fdeb9ce021daac430221 AS build + +RUN apt-get update && \ +DEBIAN_FRONTEND=noninteractive apt-get install -y \ +wget + ENV SEAFILE_VERSION=11.0.9 -RUN apk add --no-cache wget - -RUN cd /tmp && \ - wget https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz?nocache=$(date +%s) -O seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \ - tar -zxvf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \ - rm -f seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz +WORKDIR /tmp +RUN wget https://raw.githubusercontent.com/haiwen/seafile-docker/master/build/seafile-build.sh +RUN wget https://raw.githubusercontent.com/haiwen/seafile-docker/master/build/seafile-build.py +RUN chmod +x ./seafile-build.sh +RUN ./seafile-build.sh ${SEAFILE_VERSION} FROM caddy:2.8.4-alpine -COPY --from=get /tmp/seafile-server*/seahub/media /usr/share/caddy/media \ No newline at end of file +COPY --from=build /tmp/seafile-server*/seahub/media /usr/share/caddy/media \ No newline at end of file diff --git a/seahub/Dockerfile b/seahub/Dockerfile index 2e90d9a..d9644ff 100644 --- a/seahub/Dockerfile +++ b/seahub/Dockerfile @@ -1,12 +1,16 @@ -FROM alpine:3.20.2 AS get +FROM ubuntu:jammy@sha256:340d9b015b194dc6e2a13938944e0d016e57b9679963fdeb9ce021daac430221 AS build + +RUN apt-get update && \ +DEBIAN_FRONTEND=noninteractive apt-get install -y \ +wget + ENV SEAFILE_VERSION=11.0.9 -RUN apk add --no-cache wget - -RUN cd /tmp && \ - wget https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz?nocache=$(date +%s) -O seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \ - tar -zxvf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz && \ - rm -f seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz +WORKDIR /tmp +RUN wget https://raw.githubusercontent.com/haiwen/seafile-docker/master/build/seafile-build.sh +RUN wget https://raw.githubusercontent.com/haiwen/seafile-docker/master/build/seafile-build.py +RUN chmod +x ./seafile-build.sh +RUN ./seafile-build.sh ${SEAFILE_VERSION} RUN sed -i "s@.*INNER_FILE_SERVER_ROOT.*@INNER_FILE_SERVER_ROOT = os.environ.get('INNER_FILE_SERVER_ROOT')@" /tmp/seafile-server-${SEAFILE_VERSION}/seahub/seahub/settings.py @@ -66,12 +70,12 @@ gcompat \ openldap COPY --from=pip /pip-deps /usr/local/lib/python3.10/site-packages -COPY --from=get /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub -COPY --from=get /tmp/seafile-server*/runtime /opt/seafile/seafile-server-latest/runtime -COPY --from=get /tmp/seafile-server*/seahub.sh /opt/seafile/seafile-server-latest/seahub.sh -COPY --from=get /tmp/seafile-server*/check_init_admin.py /opt/seafile/seafile-server-latest/check_init_admin.py -COPY --from=get /tmp/seafile-server*/seafile/lib/python3/site-packages /opt/seafile/seafile-server-latest/seafile/lib/python3/site-packages -COPY --from=get /tmp/seafile-server*/pro/python/seafevents /opt/seafile/seafile-server-latest/pro/python/seafevents +COPY --from=build /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub +COPY --from=build /tmp/seafile-server*/runtime /opt/seafile/seafile-server-latest/runtime +COPY --from=build /tmp/seafile-server*/seahub.sh /opt/seafile/seafile-server-latest/seahub.sh +COPY --from=build /tmp/seafile-server*/check_init_admin.py /opt/seafile/seafile-server-latest/check_init_admin.py +COPY --from=build /tmp/seafile-server*/seafile/lib/python3/site-packages /opt/seafile/seafile-server-latest/seafile/lib/python3/site-packages +COPY --from=build /tmp/seafile-server*/pro/python/seafevents /opt/seafile/seafile-server-latest/pro/python/seafevents COPY scripts /scripts RUN chmod u+x /scripts/*