docker: Determine nproc for darwin. (closes #52)
docker: Further separate apt and rust cache mounts. Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -8,8 +8,8 @@ WORKDIR /
|
|||||||
COPY --link --from=input . .
|
COPY --link --from=input . .
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=cache,dst=${var_cache},sharing=locked \
|
--mount=type=cache,dst=/var/cache,id=${var_cache},sharing=locked \
|
||||||
--mount=type=cache,dst=${var_lib_apt},sharing=locked \
|
--mount=type=cache,dst=/var/lib/apt,id=${var_lib_apt},sharing=locked \
|
||||||
<<EOF
|
<<EOF
|
||||||
set -eux
|
set -eux
|
||||||
apt-get -y -U install --no-install-recommends openssl gawk
|
apt-get -y -U install --no-install-recommends openssl gawk
|
||||||
@@ -156,8 +156,8 @@ ARG complement_run=".*"
|
|||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=cache,dst=${var_cache},sharing=locked \
|
--mount=type=cache,dst=/var/cache,id=${var_cache},sharing=locked \
|
||||||
--mount=type=cache,dst=${var_lib_apt},sharing=locked \
|
--mount=type=cache,dst=/var/lib/apt,id=${var_lib_apt},sharing=locked \
|
||||||
--mount=type=cache,dst=/go/pkg/mod/cache,sharing=locked \
|
--mount=type=cache,dst=/go/pkg/mod/cache,sharing=locked \
|
||||||
<<EOF
|
<<EOF
|
||||||
set -eux
|
set -eux
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ RUN <<EOF
|
|||||||
cmake \
|
cmake \
|
||||||
--build build \
|
--build build \
|
||||||
--target install \
|
--target install \
|
||||||
--parallel ${nprocs}
|
--parallel "${nprocs}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ COPY --link --from=input . .
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND="${DEBIAN_FRONTEND}"
|
ENV DEBIAN_FRONTEND="${DEBIAN_FRONTEND}"
|
||||||
RUN \
|
RUN \
|
||||||
--mount=type=cache,dst=${var_cache},sharing=locked \
|
--mount=type=cache,dst=/var/cache,id=${var_cache},sharing=locked \
|
||||||
--mount=type=cache,dst=${var_lib_apt},sharing=locked \
|
--mount=type=cache,dst=/var/lib/apt,id=${var_lib_apt},sharing=locked \
|
||||||
<<EOF
|
<<EOF
|
||||||
echo $(uname -a) $0 $-
|
echo $(uname -a) $0 $-
|
||||||
set -eux
|
set -eux
|
||||||
|
|||||||
@@ -1466,7 +1466,7 @@ target "rust" {
|
|||||||
cargo_installs = join(" ", cargo_installs)
|
cargo_installs = join(" ", cargo_installs)
|
||||||
|
|
||||||
CARGO_TERM_VERBOSE = CARGO_TERM_VERBOSE
|
CARGO_TERM_VERBOSE = CARGO_TERM_VERBOSE
|
||||||
RUSTUP_HOME = "/opt/rust/rustup/${sys_name}"
|
RUSTUP_HOME = "/opt/rust/rustup/${sys_name}/${sys_target}"
|
||||||
CARGO_HOME = "/opt/rust/cargo/${sys_name}/${sys_target}"
|
CARGO_HOME = "/opt/rust/cargo/${sys_name}/${sys_target}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1671,8 +1671,8 @@ target "base" {
|
|||||||
}
|
}
|
||||||
args = {
|
args = {
|
||||||
DEBIAN_FRONTEND="noninteractive"
|
DEBIAN_FRONTEND="noninteractive"
|
||||||
var_lib_apt = "/var/lib/apt"
|
var_lib_apt = "/var/lib/apt/${sys_name}/${sys_version}/${sys_target}"
|
||||||
var_cache = "/var/cache"
|
var_cache = "/var/cache/${sys_name}/${sys_version}/${sys_target}"
|
||||||
packages = join(" ", base_pkgs)
|
packages = join(" ", base_pkgs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ sys_targets="${env_sys_targets:-$default_sys_targets}"
|
|||||||
sys_versions="${env_sys_versions:-$default_sys_versions}"
|
sys_versions="${env_sys_versions:-$default_sys_versions}"
|
||||||
|
|
||||||
docker_dir="$PWD/$BASEDIR"
|
docker_dir="$PWD/$BASEDIR"
|
||||||
runner_name=$(echo $RUNNER_NAME | cut -d"." -f1)
|
|
||||||
runner_num=$(echo $RUNNER_NAME | cut -d"." -f2)
|
|
||||||
builder_name="${GITHUB_ACTOR:-owo}"
|
builder_name="${GITHUB_ACTOR:-owo}"
|
||||||
toolchain_toml="$docker_dir/../rust-toolchain.toml"
|
toolchain_toml="$docker_dir/../rust-toolchain.toml"
|
||||||
rust_msrv=$(grep "channel = " "$toolchain_toml" | cut -d'=' -f2 | sed 's/\s"\|"$//g')
|
rust_msrv=$(grep "channel = " "$toolchain_toml" | cut -d'=' -f2 | sed 's/\s"\|"$//g')
|
||||||
@@ -92,11 +90,9 @@ if test "$CI" = "true"; then
|
|||||||
args="$args --allow=network.host"
|
args="$args --allow=network.host"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test ! -z "$runner_num"; then
|
if test "$(uname)" = "Darwin"; then
|
||||||
#cpu_num=$(expr $runner_num % $(nproc))
|
nprocs=$(sysctl -n hw.logicalcpu)
|
||||||
#args="$args --cpuset-cpus=${cpu_num}"
|
args="$args --set *.args.nprocs=${nprocs}"
|
||||||
#args="$args --set *.args.nprocs=1"
|
|
||||||
# https://github.com/moby/buildkit/issues/1276
|
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
nprocs=$(nproc)
|
nprocs=$(nproc)
|
||||||
|
|||||||
Reference in New Issue
Block a user