diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 7bea0d0d..59a4f8af 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -79,15 +79,16 @@ COPY ./macros ./macros ARG CARGO_PROFILE=release -# Configure the DB ARG as late as possible to not invalidate the cached layers above +# Configure the DB and FEATURES ARGs as late as possible to not invalidate the cached layers above +ARG DB=sqlite,mysql,postgresql # Enable MiMalloc to improve performance on Alpine builds -ARG DB=sqlite,mysql,postgresql,enable_mimalloc +ARG FEATURES=s3,enable_mimalloc # Builds your dependencies and removes the # dummy project, except the target folder # This folder contains the compiled dependencies RUN source /env-cargo && \ - cargo build --features ${DB} --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ + cargo build --features "${DB}" --features "${FEATURES}" --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ find . -not -path "./target*" -delete # Copies the complete project @@ -102,7 +103,7 @@ RUN source /env-cargo && \ # Also do this for build.rs to ensure the version is rechecked touch build.rs src/main.rs && \ # Create a symlink to the binary target folder to easy copy the binary in the final stage - cargo build --features ${DB} --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ + cargo build --features "${DB}" --features "${FEATURES}" --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ if [[ "${CARGO_PROFILE}" == "dev" ]] ; then \ ln -vfsr "/app/target/${CARGO_TARGET}/debug" /app/target/final ; \ else \ diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 5de9fdb5..873aa200 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -89,8 +89,9 @@ COPY ./macros ./macros ARG CARGO_PROFILE=release -# Configure the DB ARG as late as possible to not invalidate the cached layers above +# Configure the DB and FEATURES ARGs as late as possible to not invalidate the cached layers above ARG DB=sqlite,mysql,postgresql +ARG FEATURES=s3 # Builds your dependencies and removes the # dummy project, except the target folder @@ -98,7 +99,7 @@ ARG DB=sqlite,mysql,postgresql RUN source /env-cargo && \ # Workaround for xx related build issues # https://github.com/tonistiigi/xx/pull/108#issuecomment-3700635977 - PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features ${DB} --profile "${CARGO_PROFILE}" && \ + PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features "${DB}" --features "${FEATURES}" --profile "${CARGO_PROFILE}" && \ find . -not -path "./target*" -delete # Copies the complete project @@ -115,7 +116,7 @@ RUN source /env-cargo && \ # Create a symlink to the binary target folder to easy copy the binary in the final stage # Workaround for xx related build issues # https://github.com/tonistiigi/xx/pull/108#issuecomment-3700635977 - PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features ${DB} --profile "${CARGO_PROFILE}" && \ + PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features "${DB}" --features "${FEATURES}" --profile "${CARGO_PROFILE}" && \ if [[ "${CARGO_PROFILE}" == "dev" ]] ; then \ ln -vfsr "/app/target/${CARGO_TARGET}/debug" /app/target/final ; \ else \ diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 index f7a056ff..9903ca57 100644 --- a/docker/Dockerfile.j2 +++ b/docker/Dockerfile.j2 @@ -30,7 +30,7 @@ {% macro xx_cargo_config() -%} # Workaround for xx related build issues # https://github.com/tonistiigi/xx/pull/108#issuecomment-3700635977 - PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features ${DB} --profile "${CARGO_PROFILE}" + PKG_CONFIG="$(command -v "$(xx-info)-pkg-config")" xx-cargo build --features "${DB}" --features "${FEATURES}" --profile "${CARGO_PROFILE}" {%- endmacro %} FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@{{ vault_image_digest }} AS vault @@ -120,12 +120,13 @@ COPY ./macros ./macros ARG CARGO_PROFILE=release -# Configure the DB ARG as late as possible to not invalidate the cached layers above -{% if base == "debian" %} +# Configure the DB and FEATURES ARGs as late as possible to not invalidate the cached layers above ARG DB=sqlite,mysql,postgresql +{% if base == "debian" %} +ARG FEATURES=s3 {% elif base == "alpine" %} # Enable MiMalloc to improve performance on Alpine builds -ARG DB=sqlite,mysql,postgresql,enable_mimalloc +ARG FEATURES=s3,enable_mimalloc {% endif %} # Builds your dependencies and removes the @@ -135,7 +136,7 @@ RUN source /env-cargo && \ {% if base == "debian" %} {{ xx_cargo_config() }} && \ {% elif base == "alpine" %} - cargo build --features ${DB} --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ + cargo build --features "${DB}" --features "${FEATURES}" --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ {% endif %} find . -not -path "./target*" -delete @@ -154,7 +155,7 @@ RUN source /env-cargo && \ {% if base == "debian" %} {{ xx_cargo_config() }} && \ {% elif base == "alpine" %} - cargo build --features ${DB} --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ + cargo build --features "${DB}" --features "${FEATURES}" --profile "${CARGO_PROFILE}" --target="${CARGO_TARGET}" && \ {% endif %} if [[ "${CARGO_PROFILE}" == "dev" ]] ; then \ ln -vfsr "/app/target/${CARGO_TARGET}/debug" /app/target/final ; \