2025-03-15 04:23:24 +00:00
|
|
|
# syntax = docker/dockerfile:1.11-labs
|
|
|
|
|
|
|
|
|
|
FROM input AS cargo
|
|
|
|
|
ARG sys_target
|
|
|
|
|
ARG rust_toolchain
|
|
|
|
|
ARG RUSTUP_HOME
|
|
|
|
|
ARG CARGO_HOME
|
|
|
|
|
ARG CARGO_TARGET
|
|
|
|
|
ARG CARGO_TARGET_DIR
|
2025-06-01 11:40:09 +00:00
|
|
|
ARG cargo_tgt_dst
|
|
|
|
|
ARG cargo_tgt_sub
|
|
|
|
|
ARG cargo_tgt_cache
|
2025-03-15 04:23:24 +00:00
|
|
|
ARG cargo_profile
|
|
|
|
|
ARG cargo_features
|
2025-05-03 02:32:49 +00:00
|
|
|
ARG cargo_spec_features
|
2025-03-15 04:23:24 +00:00
|
|
|
ARG cargo_cmd
|
|
|
|
|
ARG cargo_args=""
|
|
|
|
|
|
2025-05-21 21:45:42 +00:00
|
|
|
WORKDIR /
|
|
|
|
|
COPY --link --from=input . .
|
|
|
|
|
|
2025-03-15 04:23:24 +00:00
|
|
|
WORKDIR /usr/lib/${sys_target}
|
|
|
|
|
COPY --link --from=rocksdb . .
|
|
|
|
|
|
|
|
|
|
WORKDIR /usr/src/tuwunel
|
|
|
|
|
RUN \
|
2025-06-01 11:40:09 +00:00
|
|
|
--mount=type=cache,dst=${RUSTUP_HOME}/downloads,sharing=shared,ro \
|
|
|
|
|
--mount=type=cache,dst=${CARGO_HOME}/registry,sharing=shared,ro \
|
|
|
|
|
--mount=type=cache,dst=${CARGO_HOME}/git,sharing=shared,ro \
|
2025-06-02 06:20:37 +00:00
|
|
|
--mount=type=cache,dst=${CARGO_TARGET_DIR},id=${cargo_tgt_dst},sharing=locked \
|
2025-06-01 11:40:09 +00:00
|
|
|
--mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/deps,id=${cargo_tgt_cache}/deps,sharing=locked \
|
|
|
|
|
--mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/build,id=${cargo_tgt_cache}/build,sharing=locked \
|
|
|
|
|
--mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/incremental,id=${cargo_tgt_cache}/incremental,sharing=locked \
|
|
|
|
|
--mount=type=cache,dst=${CARGO_TARGET_DIR}/${cargo_tgt_sub}/.fingerprint,id=${cargo_tgt_cache}/fingerprint,sharing=locked \
|
2025-03-15 04:23:24 +00:00
|
|
|
<<EOF
|
|
|
|
|
set -eux
|
|
|
|
|
rustup run ${rust_toolchain} \
|
|
|
|
|
cargo ${cargo_cmd} \
|
|
|
|
|
--frozen \
|
|
|
|
|
--workspace \
|
2025-05-03 02:32:49 +00:00
|
|
|
"${cargo_spec_features}" \
|
2025-03-15 04:23:24 +00:00
|
|
|
--features "${cargo_features}" \
|
|
|
|
|
--profile "${cargo_profile}" \
|
|
|
|
|
--target "${CARGO_TARGET}" \
|
|
|
|
|
--target-dir "${CARGO_TARGET_DIR}" \
|
|
|
|
|
--manifest-path Cargo.toml \
|
2025-05-10 04:29:08 +00:00
|
|
|
--color always \
|
2025-03-15 04:23:24 +00:00
|
|
|
${cargo_args}
|
|
|
|
|
EOF
|