From 6d1402ae67f8a845fcf4a33cd5f43943f2e12e5c Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:53:12 +0100 Subject: [PATCH] optimize dockerfile --- Dockerfile | 56 ++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index f8ab88a..7934275 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,12 @@ ARG ANONADDY_VERSION=1.3.0 ARG ALPINE_VERSION=3.21 -FROM crazymax/yasu:latest AS yasu -FROM crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3 +FROM --platform=$BUILDPLATFORM scratch AS src +ARG ANONADDY_VERSION +ADD "https://github.com/anonaddy/anonaddy.git#v${ANONADDY_VERSION}" . -COPY --from=yasu / / +FROM crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3 AS base +COPY --from=crazymax/yasu:latest / / RUN apk --no-cache add \ bash \ ca-certificates \ @@ -70,9 +72,27 @@ RUN apk --no-cache add \ && echo "extension=gnupg.so" > /etc/php83/conf.d/60_gnupg.ini \ && pecl83 install mailparse \ && echo "extension=mailparse.so" > /etc/php83/conf.d/60_mailparse.ini \ + && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \ && apk del build-dependencies \ && rm -rf /tmp/* /var/www/* +FROM base AS build +RUN apk --no-cache add nodejs npm +WORKDIR /var/www/anonaddy +COPY --from=src / . +ARG ANONADDY_VERSION +RUN <