Split build-container-image into build-container-image-{debug,release}

This allows `run-in-container` to default to using the much faster
`build-container-image-debug`.
This commit is contained in:
Slavi Pantaleev
2024-09-21 14:18:28 +00:00
parent 2a5a2d6a4d
commit c8c5e0e540
3 changed files with 32 additions and 8 deletions

View File

@@ -15,14 +15,23 @@ WORKDIR /app
COPY . /app
ARG RELEASE_BUILD=true
RUN --mount=type=cache,target=/cargo,sharing=locked \
--mount=type=cache,target=/target,sharing=locked \
cargo build --release
if [ "$RELEASE_BUILD" = "true" ]; then \
cargo build --release; \
else \
cargo build; \
fi
# Move it out of the mounted cache, so we can copy it in the next stage.
RUN --mount=type=cache,target=/target,sharing=locked \
cp /target/release/baibot /baibot
if [ "$RELEASE_BUILD" = "true" ]; then \
cp /target/release/baibot /baibot; \
else \
cp /target/debug/baibot /baibot; \
fi
#######################################
# #