Skip to content

Commit 8dd9ff6

Browse files
authored
infra: pin the container CBC to 2.10.10 on both architectures (#128)
1 parent a51031d commit 8dd9ff6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ ADD . /app
1818
RUN --mount=type=cache,target=/root/.cache/uv \
1919
uv sync --locked --no-editable --no-group dev
2020

21+
ADD --checksum=sha256:f551e7b843e25becee466a447118f6f44f219c4e46cfb4670829ecd3cf47e7d8 \
22+
https://github.com/coin-or/Cbc/releases/download/releases%2F2.10.10/Cbc-releases.2.10.10-x86_64-ubuntu22-gcc1130-static.tar.gz \
23+
/tmp/cbc.tar.gz
24+
2125
FROM python:3.13-slim
2226

2327
# Create non-root user
@@ -26,6 +30,18 @@ RUN groupadd -r app && useradd -r -g app -s /bin/false app
2630
# Copy the environment, but not the source code
2731
COPY --from=builder --chown=app:app /app/.venv /app/.venv
2832

33+
ARG TARGETARCH
34+
35+
# pulp bundles CBC 2.10.10 for arm64 but 2.10.3 from 2019 for amd64, and resolves the solver by a
36+
# fixed path with no override, so the bundled amd64 binary is linked to the fetched 2.10.10 build.
37+
RUN --mount=from=builder,source=/tmp/cbc.tar.gz,target=/tmp/cbc.tar.gz set -eu; \
38+
if [ "$TARGETARCH" = "amd64" ]; then \
39+
tar -xzf /tmp/cbc.tar.gz -C /usr/local ./bin/cbc; \
40+
find /app/.venv -path '*/pulp/solverdir/cbc/*/cbc' -exec ln -sf /usr/local/bin/cbc {} \; ; \
41+
fi; \
42+
echo | "$(/app/.venv/bin/python -c 'from pulp.apis.coin_api import pulp_cbc_path; print(pulp_cbc_path)')" \
43+
| grep -q 'Version: 2.10.10'
44+
2945
# Run the application
3046
ENV PYTHONUNBUFFERED=1
3147
ENV OPTIMIZER_TIME_LIMIT=10

0 commit comments

Comments
 (0)