ARG SWIFT_IMAGE="swift:6.0-noble" FROM ${SWIFT_IMAGE} # Install OS updates RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ && apt-get -q update \ && apt-get -q dist-upgrade -y # Set up a build area WORKDIR /build # First just resolve dependencies. # This creates a cached layer that can be reused # as long as your Package.swift/Package.resolved # files do not change. COPY ./Package.* ./ RUN --mount=type=cache,target=/build/.build swift package resolve \ $([ -f ./Package.resolved ] && echo "--force-resolved-versions" || true) # Copy entire repo into container COPY . . # Build the application, with optimizations, with static linking, and using jemalloc # N.B.: The static version of jemalloc is incompatible with the static Swift runtime. RUN swift build CMD ["swift", "test"]