mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-04 05:25:54 +08:00
Fix: Fix multiplatform build caching issues
So, alpine will download platform-specific cache files, meaning that when another platform tries to use the cache, it will fail with packages not being found.
This commit is contained in:
parent
ce640e1cd3
commit
42078d5017
2 changed files with 11 additions and 10 deletions
19
Dockerfile
19
Dockerfile
|
@ -8,14 +8,15 @@ COPY ./build-scripts ./build-scripts
|
|||
|
||||
# ============================ INSTALL BASIC SERVICES ============================
|
||||
FROM ${BASE_IMAGE} AS base
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
# Install supervisor, postfix
|
||||
# Install postfix first to get the first account (101)
|
||||
# Install opendkim second to get the second account (102)
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/apk,sharing=locked \
|
||||
--mount=type=cache,target=/etc/apk/cache,sharing=locked \
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=var-cache-apt-$TARGETPLATFORM \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=var-lib-apt-$TARGETPLATFORM \
|
||||
--mount=type=cache,target=/var/cache/apk,sharing=locked,id=var-cache-apk-$TARGETPLATFORM \
|
||||
--mount=type=cache,target=/etc/apk/cache,sharing=locked,id=etc-apk-cache-$TARGETPLATFORM \
|
||||
--mount=type=tmpfs,target=/tmp \
|
||||
--mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \
|
||||
sh /build-scripts/postfix-install.sh
|
||||
|
@ -23,14 +24,14 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||
# ============================ BUILD SASL XOAUTH2 ============================
|
||||
FROM base AS sasl
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
ARG SASL_XOAUTH2_REPO_URL=https://github.com/tarickb/sasl-xoauth2.git
|
||||
ARG SASL_XOAUTH2_GIT_REF=release-0.12
|
||||
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/apk,sharing=locked \
|
||||
--mount=type=cache,target=/etc/apk/cache,sharing=locked \
|
||||
--mount=type=cache,target=/etc/apk/cache,sharing=locked \
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=var-cache-apt-$TARGETPLATFORM \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=var-lib-apt-$TARGETPLATFORM \
|
||||
--mount=type=cache,target=/var/cache/apk,sharing=locked,id=var-cache-apk-$TARGETPLATFORM \
|
||||
--mount=type=cache,target=/etc/apk/cache,sharing=locked,id=etc-apk-cache-$TARGETPLATFORM \
|
||||
--mount=type=tmpfs,target=/tmp \
|
||||
--mount=type=tmpfs,target=/sasl-xoauth2 \
|
||||
--mount=type=bind,from=build-scripts,source=/build-scripts,target=/build-scripts \
|
||||
|
|
|
@ -15,7 +15,7 @@ if [ -f /etc/alpine-release ]; then
|
|||
apk add --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev
|
||||
do_build
|
||||
apk del .build-deps;
|
||||
else \
|
||||
else
|
||||
. /etc/lsb-release
|
||||
apt-get update -y -qq
|
||||
LIBS="git build-essential cmake pkg-config libcurl4 libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev"
|
||||
|
|
Loading…
Add table
Reference in a new issue