43 lines
1.0 KiB
Docker
43 lines
1.0 KiB
Docker
# 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
|
|
ARG cargo_profile
|
|
ARG cargo_features
|
|
ARG cargo_spec_features
|
|
ARG cargo_cmd
|
|
ARG cargo_args=""
|
|
|
|
WORKDIR /
|
|
COPY --link --from=input . .
|
|
|
|
WORKDIR /usr/lib/${sys_target}
|
|
COPY --link --from=rocksdb . .
|
|
|
|
WORKDIR /usr/src/tuwunel
|
|
RUN \
|
|
--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 \
|
|
<<EOF
|
|
set -eux
|
|
rustup run ${rust_toolchain} \
|
|
cargo ${cargo_cmd} \
|
|
--verbose \
|
|
--frozen \
|
|
--workspace \
|
|
"${cargo_spec_features}" \
|
|
--features "${cargo_features}" \
|
|
--profile "${cargo_profile}" \
|
|
--target "${CARGO_TARGET}" \
|
|
--target-dir "${CARGO_TARGET_DIR}" \
|
|
--manifest-path Cargo.toml \
|
|
--color always \
|
|
${cargo_args}
|
|
EOF
|