-
Notifications
You must be signed in to change notification settings - Fork 6
Build multi-arch images #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
12bee01
0401d49
1fcbd67
f8ddae0
b7f5def
b014fff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,9 +18,20 @@ ENV CONDA_ALWAYS_YES=true | |||||||||||||||||||||||||||||||||||||||||||||||
# but that would require baking in the URLs for | ||||||||||||||||||||||||||||||||||||||||||||||||
# different Miniconda installer versions into the Dockerfile. | ||||||||||||||||||||||||||||||||||||||||||||||||
ARG PYTHON_VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||
RUN wget --quiet "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" -O /tmp/miniconda.sh && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
ARG TARGETARCH | ||||||||||||||||||||||||||||||||||||||||||||||||
RUN case "$TARGETARCH" in \ | ||||||||||||||||||||||||||||||||||||||||||||||||
amd64) MINICONDA_ARCH="x86_64" ;; \ | ||||||||||||||||||||||||||||||||||||||||||||||||
arm64) MINICONDA_ARCH="aarch64" ;; \ | ||||||||||||||||||||||||||||||||||||||||||||||||
*) echo "Unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;; \ | ||||||||||||||||||||||||||||||||||||||||||||||||
esac && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
wget --quiet "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${MINICONDA_ARCH}.sh" -O /tmp/miniconda.sh && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+21
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Pin installer + verify checksum to harden supply chain and ensure reproducibility. “latest” is mutable and unverified. Recommend pinning a specific installer and checking SHA256. -ARG TARGETARCH
+ARG TARGETARCH
+# Pin Miniconda installer in CI (set these via build args or here)
+ARG MINICONDA_VERSION # e.g., py311_24.7.1-0
+ARG MINICONDA_SHA256 # corresponding sha256
RUN case "$TARGETARCH" in \
amd64) MINICONDA_ARCH="x86_64" ;; \
arm64) MINICONDA_ARCH="aarch64" ;; \
*) echo "Unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;; \
esac && \
- wget --quiet "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${MINICONDA_ARCH}.sh" -O /tmp/miniconda.sh && \
+ : "${MINICONDA_VERSION:?Set MINICONDA_VERSION}" && \
+ : "${MINICONDA_SHA256:?Set MINICONDA_SHA256}" && \
+ INSTALLER="Miniconda3-${MINICONDA_VERSION}-Linux-${MINICONDA_ARCH}.sh" && \
+ wget --quiet "https://repo.anaconda.com/miniconda/${INSTALLER}" -O /tmp/miniconda.sh && \
+ echo "${MINICONDA_SHA256} /tmp/miniconda.sh" | sha256sum -c - && \
/bin/bash /tmp/miniconda.sh -b -p /opt/conda && \
rm /tmp/miniconda.sh && \ 📝 Committable suggestion
Suggested change
🛠️ Refactor suggestion Good TARGETARCH mapping; add a safe default for local builds. Buildx injects TARGETARCH, but plain docker build won’t. Default to amd64 to keep local builds working. -ARG TARGETARCH
-RUN case "$TARGETARCH" in \
+ARG TARGETARCH
+# Default TARGETARCH for local non-buildx builds
+RUN : "${TARGETARCH:=amd64}" && \
+ case "$TARGETARCH" in \
amd64) MINICONDA_ARCH="x86_64" ;; \
arm64) MINICONDA_ARCH="aarch64" ;; \
*) echo "Unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;; \
- esac && \
+ esac && \
wget --quiet "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${MINICONDA_ARCH}.sh" -O /tmp/miniconda.sh && \ 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||
/bin/bash /tmp/miniconda.sh -b -p /opt/conda && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
rm /tmp/miniconda.sh && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
# Use community packages from conda-forge instead of Anaconda Inc. default channels | ||||||||||||||||||||||||||||||||||||||||||||||||
# which require accepting terms of service & using commercial license for orgs with more than 200 employees | ||||||||||||||||||||||||||||||||||||||||||||||||
/opt/conda/bin/conda config --add channels conda-forge && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
/opt/conda/bin/conda config --remove channels defaults || true && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
/opt/conda/bin/conda config --set channel_priority strict && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
# Install the correct version of python (as the time of writing, anaconda | ||||||||||||||||||||||||||||||||||||||||||||||||
# installed python 3.11 by default) for parity with our base image | ||||||||||||||||||||||||||||||||||||||||||||||||
/opt/conda/bin/conda install python=${PYTHON_VERSION} && \ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Multi-arch for python: LGTM. Also align python-conda job.
This job targets both platforms. The python-conda job (Lines 142–147) still builds only linux/amd64 and uses registry cache. Consider aligning it:
If you want consistent cache removal across jobs, drop the cache flags too.
📝 Committable suggestion