Skip to content

Commit

Permalink
use layered approach for cleaning image
Browse files Browse the repository at this point in the history
dockerhub does not support dockerfile:1.7-labs
  • Loading branch information
ggogel committed Jul 28, 2024
1 parent bea3bc7 commit 20c2865
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions seafile-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# syntax=docker/dockerfile:1.7-labs
FROM alpine:3.20.2 AS get

RUN apk add --no-cache wget
Expand All @@ -10,6 +9,14 @@ RUN cd /tmp && \
tar -zxvf 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

RUN apt-get update && \
Expand Down Expand Up @@ -57,7 +64,7 @@ python3 \

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/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
Expand All @@ -78,4 +85,4 @@ mkdir -p /etc/ldap/ && echo "TLS_REQCERT allow" >> /etc/ldap/ldap.conf

EXPOSE 8001 8080 8082 8083

CMD ["/scripts/start.sh"]
CMD ["/scripts/start.sh"]

0 comments on commit 20c2865

Please sign in to comment.