This repository contains the docker configuration for the magic container image.
The magic container image is based on different base images, depending on the use case.
All images have magic installed in /usr/local/bin/magic and are ready to use.
The images are available on "GHCR" (Github Container Registry). You can pull them using docker like so:
docker pull ghcr.io/modular/magic:latestThere are different tags for different base images available:
latest- based onubuntu:noblefocal- based onubuntu:focalbullseye- based ondebian:bullseyenoble-cuda-12.6.3- based onnvidia/cuda:12.6.3-ubuntu24.04- ... and more
The following example uses the magic docker image as a base image for a multi-stage build.
It also makes use of the shell-hook feature of magic to define a convenient entry point (after executing the shell-hook script, the environment is activated.
FROM ghcr.io/modular/magic:latest AS build
# copy source code, pixi.toml and magic.lock to the containerCOPY . /app
WORKDIR /app
# run some compilation / build task (if needed)RUN magic run build
# run the `install` command (or any other). This will also install the dependencies into `/app/.magic`# assumes that you have a `prod` environment defined in your pixi.tomlRUN magic run install -e prod
# Create the shell-hook bash script to activate the environmentRUN magic shell-hook -e prod > /shell-hook.sh
# extend the shell-hook script to run the command passed to the containerRUN echo 'exec "$@"' >> /shell-hook.sh
FROM ubuntu:24.04 AS production
# only copy the production environment into prod container# please note that the "prefix" (path) needs to stay the same as in the build containerCOPY --from=build /app/.magic/envs/prod /app/.magic/envs/prod
COPY --from=build /shell-hook.sh /shell-hook.sh
WORKDIR /app
EXPOSE 8000
# set the entrypoint to the shell-hook script (activate the environment and run the command)# no more magic needed in the prod containerENTRYPOINT ["/bin/bash", "/shell-hook.sh"]
CMD ["start-server"]There are images based on ubuntu, debian and nvidia/cuda available.
The ubuntu:noble (24.04) based image is the default base image. It is used for the latest and 0.x.y tag.
There are also images based on ubuntu:focal (20.04), ubuntu:jammy (22.04), ubuntu:oracular (24.10) and ubuntu:plucky (25.04) available.
These images use the tags focal, 0.x.y-focal, ...
Images based on debian:bullseye, debian:bullseye-slim (11), debian:bookworm and debian:bookworm-slim (12) are available.
These images have the tags bullseye, 0.x.y-bullseye, ...
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, ...