use layered approach for cleaning image

dockerhub does not support dockerfile:1.7-labs
This commit is contained in:
Gerrit Gogel 2024-07-28 14:54:36 +02:00
parent bea3bc7f11
commit 20c2865ba9

View file

@ -1,4 +1,3 @@
# syntax=docker/dockerfile:1.7-labs
FROM alpine:3.20.2 AS get FROM alpine:3.20.2 AS get
RUN apk add --no-cache wget RUN apk add --no-cache wget
@ -10,6 +9,14 @@ RUN cd /tmp && \
tar -zxvf 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 rm -f seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
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}
RUN rm -rf /tmp/seafile-server-${SEAFILE_VERSION}/seahub
FROM ubuntu:jammy@sha256:340d9b015b194dc6e2a13938944e0d016e57b9679963fdeb9ce021daac430221 AS pip FROM ubuntu:jammy@sha256:340d9b015b194dc6e2a13938944e0d016e57b9679963fdeb9ce021daac430221 AS pip
RUN apt-get update && \ RUN apt-get update && \
@ -57,7 +64,7 @@ python3 \
COPY --from=pip /pip-deps /usr/local/lib/python3.10/dist-packages COPY --from=pip /pip-deps /usr/local/lib/python3.10/dist-packages
COPY --from=get --exclude=/tmp/seafile-server-${SEAFILE_VERSION}/seahub /tmp/seafile-server-${SEAFILE_VERSION} /opt/seafile/seafile-server-${SEAFILE_VERSION} 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/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/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/media/avatars /opt/seafile/seafile-server-${SEAFILE_VERSION}/seahub/media/avatars
@ -78,4 +85,4 @@ mkdir -p /etc/ldap/ && echo "TLS_REQCERT allow" >> /etc/ldap/ldap.conf
EXPOSE 8001 8080 8082 8083 EXPOSE 8001 8080 8082 8083
CMD ["/scripts/start.sh"] CMD ["/scripts/start.sh"]