feat: Finishes filter pressure drop calculator

This commit is contained in:
2025-03-03 12:55:06 -05:00
parent eb6ec446dc
commit 8e0860af8e
10 changed files with 279 additions and 54 deletions

View File

@@ -1,8 +1,14 @@
# NOTE: Builds currently fail when building in release mode.
ARG SWIFT_MODE="debug"
# ================================
# Build image
# ================================
FROM swift:6.0-noble AS build
ARG SWIFT_MODE
# Install OS updates
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
&& apt-get -q update \
@@ -17,30 +23,35 @@ WORKDIR /build
# as long as your Package.swift/Package.resolved
# files do not change.
COPY ./Package.* ./
RUN swift package resolve \
$([ -f ./Package.resolved ] && echo "--force-resolved-versions" || true)
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 -c release \
--product App \
--static-swift-stdlib \
-Xlinker -ljemalloc
RUN --mount=type=cache,target=/build/.build swift build \
-c ${SWIFT_MODE} \
--product App \
--static-swift-stdlib \
-Xswiftc -g \
-Xlinker -ljemalloc
# Switch to the staging area
WORKDIR /staging
# Copy main executable to staging area
RUN cp "$(swift build --package-path /build -c release --show-bin-path)/App" ./
RUN --mount=type=cache,target=/build/.build cp \
"$(swift build --package-path /build -c ${SWIFT_MODE} --show-bin-path)/App" ./
# Copy static swift backtracer binary to staging area
RUN cp "/usr/libexec/swift/linux/swift-backtrace-static" ./
RUN --mount=type=cache,target=/build/.build \
cp "/usr/libexec/swift/linux/swift-backtrace-static" ./
# Copy resources bundled by SPM to staging area
RUN find -L "$(swift build --package-path /build -c release --show-bin-path)/" -regex '.*\.resources$' -exec cp -Ra {} ./ \;
RUN --mount=type=cache,target=/build/.build \
find -L "$(swift build --package-path /build -c ${SWIFT_MODE} --show-bin-path)/" -regex '.*\.resources$' -exec cp -Ra {} ./ \;
# Copy any resources from the public directory and views directory if the directories exist
# Ensure that by default, neither the directory nor any of its contents are writable.