Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ RUN --mount=type=bind,source=./bin/apt-install.sh,target=/tmp/apt-install.sh \
ENV CC=clang
ENV CXX=clang++

# Override at build time with --build-arg SKIP_CAPACITY=<value> to fit the
# build host's memory budget. Empty (the default) preserves the runtime's
# own 16 GB default for local dev builds.
ARG SKIP_CAPACITY=
ENV SKIP_CAPACITY=$SKIP_CAPACITY

FROM skiplang-base AS bootstrap

ARG STAGE=0
Expand Down
16 changes: 16 additions & 0 deletions bin/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
# Environment variables:
# STAGE Compiler bootstrap stage (default: 0). Passed as STAGE
# build arg to the root Dockerfile (skiplang/skip targets).
# SKIP_CAPACITY If set, forwarded as SKIP_CAPACITY build arg to targets
# that invoke the Skip toolchain at build time, capping
# the runtime's mmap reservation. Required on hosts that
# enforce virtual memory limits (e.g. gen2 CI builders).
# DOCKER_DEFAULT_ARCH Default platform(s) when --arch is not given.
# Supports same shorthands as --arch.
#
Expand Down Expand Up @@ -198,6 +202,18 @@ if [[ -n "${STAGE:-}" ]]; then
BAKE_ARGS+=(--set "skiplang.args.STAGE=$STAGE" --set "skip.args.STAGE=$STAGE")
fi

# Forward SKIP_CAPACITY to targets that invoke the Skip toolchain at build
# time. Required on memory-constrained hosts (e.g. gen2 CircleCI builders)
# where the runtime's 16 GB default mmap would fail.
if [[ -n "${SKIP_CAPACITY:-}" ]]; then
BAKE_ARGS+=(
--set "skiplang.args.SKIP_CAPACITY=$SKIP_CAPACITY"
--set "skip.args.SKIP_CAPACITY=$SKIP_CAPACITY"
--set "skiplang-bin-builder.args.SKIP_CAPACITY=$SKIP_CAPACITY"
--set "skipruntime.args.SKIP_CAPACITY=$SKIP_CAPACITY"
)
fi

# Determine which bake targets to build
BAKE_TARGETS=()

Expand Down
6 changes: 6 additions & 0 deletions skiplang/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ RUN --mount=type=cache,id=apt-cache-$TARGETARCH,target=/var/cache/apt,sharing=lo
ENV CC=clang
ENV CXX=clang++

# Override at build time with --build-arg SKIP_CAPACITY=<value> to fit the
# build host's memory budget. Empty (the default) preserves the runtime's
# own 16 GB default for local dev builds.
ARG SKIP_CAPACITY=
ENV SKIP_CAPACITY=$SKIP_CAPACITY

FROM base AS skiplang

COPY ./skiplang /work/skiplang
Expand Down
6 changes: 6 additions & 0 deletions skipruntime-ts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

FROM skiplabs/skiplang-bin-builder AS build

# Override at build time with --build-arg SKIP_CAPACITY=<value> to fit the
# build host's memory budget. Empty (the default) preserves the runtime's
# own 16 GB default for local dev builds.
ARG SKIP_CAPACITY=
ENV SKIP_CAPACITY=$SKIP_CAPACITY

COPY ./skiplang /work/skiplang
COPY ./skipruntime-ts /work/skipruntime-ts

Expand Down
2 changes: 1 addition & 1 deletion skipruntime-ts/tests/native_addon/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ set -euo pipefail
# build, run, and remove the test container
TEMP_FILE=$(mktemp)
docker build --iidfile "$TEMP_FILE" .
docker run --rm "$(cat "$TEMP_FILE")"
docker run --rm -e SKIP_CAPACITY "$(cat "$TEMP_FILE")"
rm "$TEMP_FILE"
2 changes: 1 addition & 1 deletion skipruntime-ts/tests/native_addon_unreleased/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ for arch in ${ARCH//,/ }; do
echo "Testing linux/$arch..."
TEMP_FILE=$(mktemp)
docker build --platform="linux/$arch" --iidfile "$TEMP_FILE" .
docker run --rm "$(cat "$TEMP_FILE")"
docker run --rm -e SKIP_CAPACITY "$(cat "$TEMP_FILE")"
rm "$TEMP_FILE"
done