Make the Docker image runnable out of the box - #64
Conversation
Review Summary by QodoMake Docker image runnable out of the box
WalkthroughsDescription• Update Docker base image from gcc:4.9 to gcc:13-bookworm • Build Edax and download evaluation data during image build • Add entrypoint to make container directly runnable • Simplify Docker workflow to single docker run command • Install required build tools (make, clang, curl, p7zip-full) Diagramflowchart LR
A["Old Dockerfile<br/>gcc:4.9"] -->|Update base image| B["New Dockerfile<br/>gcc:13-bookworm"]
B -->|Install tools| C["Build environment<br/>make, clang, curl, p7zip"]
C -->|Build Edax| D["Compiled binary<br/>lEdax"]
C -->|Download & extract| E["Evaluation data<br/>eval.7z"]
D -->|Set entrypoint| F["Runnable container<br/>docker run edax"]
E -->|Set entrypoint| F
G["Old README<br/>Manual steps"] -->|Simplify| H["New README<br/>Two commands"]
File Changes1. Dockerfile
|
Code Review by Qodo
1. Too-new CPU target
|
| x86_64|amd64) EDAX_ARCH='x86-64-v3' ;; \ | ||
| aarch64|arm64) EDAX_ARCH='armv8.5-a' ;; \ |
There was a problem hiding this comment.
1. Too-new cpu target 🐞 Bug ⛯ Reliability
The Dockerfile forces ARCH to x86-64-v3 / armv8.5-a, which compiles with -march for those ISAs and can crash at runtime on older CPUs that lack those instruction sets. This breaks the goal of being runnable out-of-the-box on typical x86_64/arm64 hosts.
Agent Prompt
## Issue description
The Docker image currently compiles Edax with `-march=x86-64-v3` on amd64 and `-march=armv8.5-a` on arm64. These targets can produce binaries that crash with illegal-instruction on older CPUs.
## Issue Context
The Makefile passes `ARCH` directly into `-march=$(ARCH)`, so the chosen `EDAX_ARCH` becomes a hard runtime requirement.
## Fix Focus Areas
- Dockerfile[19-26]
## Suggested approach
- Change defaults to broadly compatible baselines:
- amd64: `x86-64` (or at most `x86-64-v2`)
- arm64: `armv8-a`
- Add `ARG EDAX_ARCH` so advanced users can opt into `x86-64-v3`, `x86-64-v4`, `armv8.5-a`, etc.
- Use `EDAX_ARCH="${EDAX_ARCH:-<default>}"` after selecting a platform default, so overrides work cleanly.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| curl -fL -o eval.7z https://github.com/abulmo/edax-reversi/releases/download/v4.4/eval.7z; \ | ||
| 7z x -y eval.7z; \ |
There was a problem hiding this comment.
2. Unverified eval download 🐞 Bug ⛨ Security
The Docker build downloads and extracts eval.7z without any checksum/signature verification, allowing a tampered or corrupted artifact to be baked into the produced image. This is a supply-chain security risk and can also make builds non-reproducible.
Agent Prompt
## Issue description
The image build downloads `eval.7z` and extracts it without validating integrity/authenticity.
## Issue Context
Any compromise of the download path (or upstream asset replacement) can inject unexpected content into the image.
## Fix Focus Areas
- Dockerfile[28-30]
## Suggested approach
- Add a pinned checksum and verify before extraction, e.g.:
- `ARG EVAL_SHA256=<known>`
- `echo "$EVAL_SHA256 eval.7z" | sha256sum -c -`
- (Optional) Prefer signature verification if the project publishes signed checksums/releases.
- Fail the build if verification fails.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
This PR updates the sample Docker setup so Edax can be built and run directly from the image.
Previously, the Docker instructions required several manual steps after
docker run, including building Edax inside the container, downloading the evaluation data, extracting it, and launching the binary manually.With this change, the Docker image becomes runnable out of the box:
docker build . -t edax docker run --rm -it edaxChanges
gcc:4.9togcc:13-bookwormmakeclangcurlp7zip-fulldocker buildproblemfiles from the Docker image# simple samplecomment in the DockerfileWhy
The previous Docker setup no longer worked as documented:
This PR keeps the Dockerfile as a simple sample, while making the documented Docker flow reproducible and immediately usable.
Result
After this change, users can start Edax with:
docker build . -t edax docker run --rm -it edaxNotes
problemdirectory was excluded because it contains solver problem data and is not required for normal interactive play