Skip to content
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

🐍 Add Miniconda #5

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ jobs:
output-file: "sbom.cyclonedx.json"

- name: Attest
uses: actions/attest-build-provenance@310b0a4a3b0b78ef57ecda988ee04b132db73ef8 # v1.4.1
uses: actions/attest-build-provenance@6149ea5740be74af77f260b9db67e633f6b0a9a1 # v1.4.2
id: attest
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.build_and_push.outputs.digest }}
push-to-registry: true

- name: Attest SBOM
uses: actions/attest-sbom@f19ab44411e02574a74181cec8eb584319d0f779 # v1.4.0
uses: actions/attest-sbom@5026d3663739160db546203eeaffa6aa1c51a4d6 # v1.4.1
id: attest_sbom
with:
subject-name: ghcr.io/${{ github.repository }}
Expand Down
24 changes: 21 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#checkov:skip=CKV_DOCKER_2: HEALTHCHECK not required - Health checks are implemented downstream of this image

FROM public.ecr.aws/ubuntu/ubuntu@sha256:65ccda647ad998c36c5b0365e308ec0b1bc770ace445d5e954d55ac8c19a9c27
FROM public.ecr.aws/ubuntu/ubuntu@sha256:1dcbe7904c076a9be067b013d8d6aa33fad8d183bd24f27aa40b488b0ea7780e

LABEL org.opencontainers.image.vendor="Ministry of Justice" \
org.opencontainers.image.authors="Analytical Platform (analytical-platform@digital.justice.gov.uk)" \
Expand All @@ -15,14 +15,16 @@ ENV CONTAINER_USER="analyticalplatform" \
ANALYTICAL_PLATFORM_DIRECTORY="/opt/analytical-platform" \
DEBIAN_FRONTEND="noninteractive" \
PIP_BREAK_SYSTEM_PACKAGES="1" \
MINICONDA_VERSION="24.7.1-0" \
MINICONDA_SHA256="33442cd3813df33dcbb4a932b938ee95398be98344dff4c30f7e757cd2110e4f" \
CUDA_VERSION="12.5.1" \
NVIDIA_DISABLE_REQUIRE="true" \
NVIDIA_CUDA_CUDART_VERSION="12.5.82-1" \
NVIDIA_CUDA_COMPAT_VERSION="555.42.06-1" \
NVIDIA_VISIBLE_DEVICES="all" \
NVIDIA_DRIVER_CAPABILITIES="compute,utility" \
LD_LIBRARY_PATH="/usr/local/nvidia/lib:/usr/local/nvidia/lib64" \
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:${HOME}/.local/bin:${PATH}"
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/conda/bin:/home/analyticalplatform/.local/bin:${PATH}"

SHELL ["/bin/bash", "-e", "-u", "-o", "pipefail", "-c"]

Expand All @@ -49,7 +51,7 @@ apt-get update --yes
apt-get install --yes \
"apt-transport-https=2.7.14build2" \
"ca-certificates=20240203" \
"curl=8.5.0-2ubuntu10.2" \
"curl=8.5.0-2ubuntu10.3" \
"git=1:2.43.0-1ubuntu7.1" \
"jq=1.7.1-3build1" \
"python3.12=3.12.3-1ubuntu0.1" \
Expand All @@ -63,6 +65,22 @@ rm --force --recursive /var/lib/apt/lists/*
install --directory --owner "${CONTAINER_USER}" --group "${CONTAINER_GROUP}" --mode 0755 "${ANALYTICAL_PLATFORM_DIRECTORY}"
EOF

# Miniconda
# Installs Miniconda (https://docs.anaconda.com/miniconda/)
RUN <<EOF
curl --location --fail-with-body \
"https://repo.anaconda.com/miniconda/Miniconda3-py312_${MINICONDA_VERSION}-Linux-x86_64.sh" \
--output "miniconda.sh"

echo "${MINICONDA_SHA256} miniconda.sh" | sha256sum --check

bash miniconda.sh -b -p /opt/conda

chown --recursive "${CONTAINER_USER}":"${CONTAINER_GROUP}" /opt/conda

rm --force miniconda.sh
EOF

# NVIDIA CUDA
RUN <<EOF
curl --location --fail-with-body \
Expand Down
12 changes: 11 additions & 1 deletion test/container-structure-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,20 @@ commandTests:
expectedOutput: ["Python 3.12.3"]

- name: "pip (system)"
command: "pip"
command: "/usr/bin/pip3"
args: ["--version"]
expectedOutput: ["pip 24.0"]

- name: "python (conda)"
command: "python"
args: ["--version"]
expectedOutput: ["Python 3.12.4"]

- name: "pip (conda)"
command: "pip"
args: ["--version"]
expectedOutput: ["pip 24.2"]

fileExistenceTests:
- name: "/opt/analytical-platform"
path: "/opt/analytical-platform"
Expand Down