Skip to content

Commit efee90d

Browse files
zbowlingpavelzw
andauthored
Switch default base image and to magic update to 0.6.4 (#7)
* Switch default base image, adjust other base images (prefix-dev#75) * Update Dockerfile --------- Co-authored-by: Pavel Zwerschke <[email protected]>
1 parent e514985 commit efee90d

File tree

4 files changed

+117
-117
lines changed

4 files changed

+117
-117
lines changed

.github/workflows/build.yml

Lines changed: 108 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
version-changed: ${{ steps.version-metadata.outputs.changed }}
1919
new-version: ${{ steps.version-metadata.outputs.newVersion }}
2020
steps:
21-
- uses: actions/checkout@v4
22-
- uses: Quantco/ui-actions/version-metadata@v1
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
- uses: Quantco/ui-actions/version-metadata@cd71d2a0e30b25569f6d723e57acca83347e58fc # v1.0.18
2323
id: version-metadata
2424
with:
2525
file: Dockerfile
@@ -39,131 +39,131 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
base-image:
42-
- debian:bookworm-slim # 12
43-
- debian:bookworm # 12
44-
- debian:bullseye-slim # 11
45-
- debian:bullseye # 11
46-
- ubuntu:noble # 24.04
47-
- ubuntu:mantic # 23.10
48-
- ubuntu:jammy # 22.04
49-
- ubuntu:focal # 20.04
50-
- nvidia/cuda:12.6.3-base-ubuntu24.04
51-
- nvidia/cuda:12.6.3-base-ubuntu22.04
52-
- nvidia/cuda:12.6.1-base-ubuntu24.04
53-
- nvidia/cuda:12.6.1-base-ubuntu22.04
54-
- nvidia/cuda:12.3.1-base-ubuntu22.04
55-
- nvidia/cuda:12.3.1-base-ubuntu20.04
56-
- nvidia/cuda:12.2.2-base-ubuntu22.04
57-
- nvidia/cuda:12.2.2-base-ubuntu20.04
58-
- nvidia/cuda:12.1.1-base-ubuntu22.04
59-
- nvidia/cuda:12.1.1-base-ubuntu20.04
60-
- nvidia/cuda:11.8.0-base-ubuntu22.04
61-
- nvidia/cuda:11.8.0-base-ubuntu20.04
62-
- nvidia/cuda:11.7.1-base-ubuntu22.04
63-
- nvidia/cuda:11.7.1-base-ubuntu20.04
64-
- nvidia/cuda:11.6.2-base-ubuntu20.04
65-
- nvidia/cuda:11.4.3-base-ubuntu20.04
66-
- nvidia/cuda:11.3.1-base-ubuntu20.04
67-
- nvidia/cuda:11.2.2-base-ubuntu20.04
42+
# https://hub.docker.com/_/debian
43+
- debian:bookworm-slim # 12
44+
- debian:bookworm # 12
45+
- debian:bullseye-slim # 11
46+
- debian:bullseye # 11
47+
# https://hub.docker.com/_/ubuntu
48+
- ubuntu:plucky # 25.04
49+
- ubuntu:oracular # 24.10
50+
- ubuntu:noble # 24.04
51+
- ubuntu:jammy # 22.04
52+
- ubuntu:focal # 20.04
53+
# https://hub.docker.com/r/nvidia/cuda
54+
- nvidia/cuda:12.6.3-base-ubuntu24.04
55+
- nvidia/cuda:12.6.3-base-ubuntu22.04
56+
- nvidia/cuda:12.6.3-base-ubuntu20.04
57+
- nvidia/cuda:12.3.1-base-ubuntu22.04
58+
- nvidia/cuda:12.3.1-base-ubuntu20.04
59+
- nvidia/cuda:12.2.2-base-ubuntu22.04
60+
- nvidia/cuda:12.2.2-base-ubuntu20.04
61+
- nvidia/cuda:12.1.1-base-ubuntu22.04
62+
- nvidia/cuda:12.1.1-base-ubuntu20.04
6863
steps:
69-
- name: Checkout source
70-
uses: actions/checkout@v4
71-
- name: Set image variables
72-
id: image-variables
73-
env:
74-
IMAGE: ${{ matrix.base-image }}
75-
run: |
76-
import os
64+
- name: Checkout source
65+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
66+
- name: Set image variables
67+
id: image-variables
68+
env:
69+
IMAGE: ${{ matrix.base-image }}
70+
run: |
71+
import os
7772
78-
base_image = "${{ matrix.base-image }}"
79-
if base_image.startswith("nvidia/cuda"):
80-
code_names = {
81-
"22.04": "jammy",
82-
"20.04": "focal",
83-
"23.10": "mantic",
84-
"24.04": "noble",
85-
}
86-
ubuntu_version_number = base_image.split("-ubuntu")[-1]
87-
base_tag = base_image.split(":")[-1]
88-
cuda_version = base_tag.split("-")[0]
89-
tag = f"{code_names[ubuntu_version_number]}-cuda-{cuda_version}"
90-
platforms = "linux/amd64,linux/arm64"
91-
else:
92-
tag = base_image.split(":")[-1]
93-
platforms = "linux/amd64,linux/arm64"
94-
is_default = "true" if base_image == "${{ env.DEFAULT_BASE_IMAGE }}" else "false"
73+
base_image = "${{ matrix.base-image }}"
74+
if base_image.startswith("nvidia/cuda"):
75+
code_names = {
76+
"22.04": "jammy",
77+
"20.04": "focal",
78+
"24.04": "noble",
79+
"24.10": "oracular",
80+
"25.05": "plucky"
81+
}
82+
ubuntu_version_number = base_image.split("-ubuntu")[-1]
83+
base_tag = base_image.split(":")[-1]
84+
cuda_version = base_tag.split("-")[0]
85+
tag = f"{code_names[ubuntu_version_number]}-cuda-{cuda_version}"
86+
platforms = "linux/amd64,linux/arm64"
87+
else:
88+
tag = base_image.split(":")[-1]
89+
platforms = "linux/amd64,linux/arm64"
90+
is_default = "true" if base_image == "${{ env.DEFAULT_BASE_IMAGE }}" else "false"
9591
96-
GITHUB_OUTPUT = os.environ["GITHUB_OUTPUT"]
97-
with open(GITHUB_OUTPUT, "a") as f:
98-
f.write(f"tag={tag}\n")
99-
f.write(f"platforms={platforms}\n")
100-
f.write(f"is-default={is_default}\n")
101-
shell: python
102-
- name: Get docker metadata
103-
id: metadata
104-
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
105-
with:
106-
images: |-
107-
ghcr.io/modular/magic
108-
flavor: latest=false
109-
# latest
110-
# base-image
111-
# major.minor.patch
112-
# major.minor.patch-base-image
113-
tags: |
92+
GITHUB_OUTPUT = os.environ["GITHUB_OUTPUT"]
93+
with open(GITHUB_OUTPUT, "a") as f:
94+
f.write(f"tag={tag}\n")
95+
f.write(f"platforms={platforms}\n")
96+
f.write(f"is-default={is_default}\n")
97+
shell: python
98+
- name: Get docker metadata
99+
id: metadata
100+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
101+
with:
102+
images: |-
103+
ghcr.io/modular/magic
104+
flavor: latest=false
105+
# latest
106+
# base-image
107+
# major.minor.patch
108+
# major.minor.patch-base-image
109+
tags: |
114110
type=raw,value=latest,priority=1000,enable=${{ steps.image-variables.outputs.is-default }}
115111
type=raw,value=${{ steps.image-variables.outputs.tag }},priority=900
116112
type=semver,pattern={{version}},enable=${{ steps.image-variables.outputs.is-default }},value=${{ needs.version.outputs.new-version }},priority=800
117113
type=semver,pattern={{version}}-${{ steps.image-variables.outputs.tag }},value=${{ needs.version.outputs.new-version }},priority=500
118-
- name: Setup docker buildx
119-
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5
120-
- name: Login to GHCR
121-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
122-
with:
123-
registry: ghcr.io
124-
username: ${{ github.actor }}
125-
password: ${{ secrets.GITHUB_TOKEN }}
126-
- name: Build Docker images
127-
id: build
128-
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
129-
with:
130-
# provenance: false is needed to avoid unkown/unknown os/arch on ghcr
131-
# see: https://github.com/docker/build-push-action/issues/820
132-
provenance: false
133-
platforms: ${{ steps.image-variables.outputs.platforms }}
134-
push: ${{ needs.version.outputs.push == 'true' }}
135-
build-args: |-
136-
BASE_IMAGE=${{ matrix.base-image }}
137-
tags: ${{ steps.metadata.outputs.tags }}
138-
labels: ${{ steps.metadata.outputs.labels }}
139-
- uses: actions/upload-artifact@v4
140-
with:
141-
name: ${{ steps.image-variables.outputs.tag }}
142-
path: ${{ steps.metadata.outputs.bake-file }}
143-
- name: Run tests
144-
# buildx does not support outputting the image so we need to pull it and run tests
145-
if: needs.version.outputs.push == 'true'
146-
run: |
147-
docker images
148-
docker run --rm ghcr.io/modular/magic:${{ needs.version.outputs.new-version }}-${{ steps.image-variables.outputs.tag }} magic --version
149-
docker run --rm ghcr.io/modular/magic:${{ needs.version.outputs.new-version }}-${{ steps.image-variables.outputs.tag }} sh -c "mkdir /app && cd /app && magic init && magic add python && magic run python --version"
150-
- name: Image digest
151-
run: echo ${{ steps.build.outputs.digest }}
114+
- name: Setup docker buildx
115+
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
116+
- name: Login to GHCR
117+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
118+
with:
119+
registry: ghcr.io
120+
username: ${{ github.actor }}
121+
password: ${{ secrets.GITHUB_TOKEN }}
122+
- name: Build Docker images
123+
id: build
124+
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0
125+
with:
126+
# provenance: false is needed to avoid unkown/unknown os/arch on ghcr
127+
# see: https://github.com/docker/build-push-action/issues/820
128+
provenance: false
129+
platforms: ${{ steps.image-variables.outputs.platforms }}
130+
push: ${{ needs.version.outputs.push == 'true' }}
131+
build-args: |-
132+
BASE_IMAGE=${{ matrix.base-image }}
133+
tags: ${{ steps.metadata.outputs.tags }}
134+
labels: ${{ steps.metadata.outputs.labels }}
135+
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
136+
with:
137+
name: ${{ steps.image-variables.outputs.tag }}
138+
path: ${{ steps.metadata.outputs.bake-file }}
139+
- name: Run tests
140+
# buildx does not support outputting the image so we need to pull it and run tests
141+
if: needs.version.outputs.push == 'true'
142+
run: |
143+
docker images
144+
# Test the magic binary is available
145+
docker run --rm ghcr.io/modular/magic:${{ needs.version.outputs.new-version }}-${{ steps.image-variables.outputs.tag }} magic --version
146+
# Test end-to-end magic workflow
147+
docker run --rm ghcr.io/modular/magic:${{ needs.version.outputs.new-version }}-${{ steps.image-variables.outputs.tag }} sh -c "mkdir /app && cd /app && magic init && magic add python && magic run python --version"
148+
# Test magic global binaries are in PATH
149+
docker run --rm ghcr.io/modular/magic:${{ needs.version.outputs.new-version }}-${{ steps.image-variables.outputs.tag }} sh -c "magic global install rsync && rsync --version"
150+
- name: Image digest
151+
run: echo ${{ steps.build.outputs.digest }}
152152

153153
release:
154154
needs: [version, build]
155-
runs-on: ubuntu-22.04
155+
runs-on: ubuntu-latest
156156
permissions:
157157
contents: write
158158
if: needs.version.outputs.push == 'true'
159159
steps:
160-
- uses: actions/checkout@v4
160+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
161161
- name: Push ${{ needs.version.outputs.new-version }} tag
162162
run: |
163163
git tag ${{ needs.version.outputs.new-version }}
164164
git push origin ${{ needs.version.outputs.new-version }}
165165
- name: Create release
166-
uses: softprops/action-gh-release@v2
166+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
167167
with:
168168
generate_release_notes: true
169169
tag_name: ${{ needs.version.outputs.new-version }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG MAGIC_VERSION=0.6.2
1+
ARG MAGIC_VERSION=0.6.4
22
ARG BASE_IMAGE=debian:bookworm-slim
33

44
FROM --platform=$TARGETPLATFORM ubuntu:24.04 AS builder

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ docker pull ghcr.io/modular/magic:latest
1515

1616
There are different tags for different base images available:
1717

18-
- `latest` - based on `ubuntu:jammy`
18+
- `latest` - based on `ubuntu:noble`
1919
- `focal` - based on `ubuntu:focal`
2020
- `bullseye` - based on `debian:bullseye`
21-
- `jammy-cuda-12.2.2` - based on `nvidia/cuda:12.2.2-jammy`
21+
- `noble-cuda-12.6.3` - based on `nvidia/cuda:12.6.3-ubuntu24.04`
2222
- ... and more
2323

2424
## Usage with shell-hook
@@ -65,17 +65,17 @@ There are images based on `ubuntu`, `debian` and `nvidia/cuda` available.
6565

6666
### Ubuntu
6767

68-
The `ubuntu:jammy` (22.04) based image is the default base image. It is used for the `latest` and `0.x.y` tag.
68+
The [`ubuntu:noble`](https://hub.docker.com/_/ubuntu) (24.04) based image is the default base image. It is used for the `latest` and `0.x.y` tag.
6969

70-
There are also images based on `ubuntu:focal` (20.04), `ubuntu:mantic` (23.10) and `ubuntu:noble` (24.04) available.
70+
There are also images based on `ubuntu:focal` (20.04), `ubuntu:jammy` (22.04), `ubuntu:oracular` (24.10) and `ubuntu:plucky` (25.04) available.
7171
These images use the tags `focal`, `0.x.y-focal`, ...
7272

7373
### Debian
7474

75-
Images based on `debian:bullseye`, `debian:bullseye-slim` (11), `debian:bookworm` and `debian:bookworm-slim` (12) are available.
75+
Images based on [`debian:bullseye`](https://hub.docker.com/_/debian), `debian:bullseye-slim` (11), `debian:bookworm` and `debian:bookworm-slim` (12) are available.
7676

7777
These images have the tags `bullseye`, `0.x.y-bullseye`, ...
7878

7979
### NVIDIA/CUDA
8080

81-
Images based on `nvidia/cuda` are available using the tags `cuda-<cuda-version>-jammy`, `cuda-<cuda-version>-focal`, `0.x.y-cuda-<cuda-version>-jammy`, ...
81+
Images based on [`nvidia/cuda`](https://hub.docker.com/r/nvidia/cuda) are available using the tags `cuda-<cuda-version>-jammy`, `cuda-<cuda-version>-focal`, `0.x.y-cuda-<cuda-version>-jammy`, ...

example/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/modular/magic:0.4.0 AS build
1+
FROM ghcr.io/modular/magic:latest AS build
22

33
# copy source code, pixi.toml and pixi.lock to the container
44
COPY . /app
@@ -14,7 +14,7 @@ RUN magic shell-hook -e prod > /shell-hook.sh
1414
# extend the shell-hook script to run the command passed to the container
1515
RUN echo 'exec "$@"' >> /shell-hook.sh
1616

17-
FROM ubuntu:22.04 AS production
17+
FROM ubuntu:24.04 AS production
1818

1919
# only copy the production environment into prod container
2020
# please note that the "prefix" (path) needs to stay the same as in the build container

0 commit comments

Comments
 (0)