Skip to content

Multi-arch (linux/amd64, linux/arm64/v8) Mojo dev container

License

Notifications You must be signed in to change notification settings

benz0li/mojo-dev-container

Repository files navigation

Mojo dev container

minimal-readme compliant Project Status: Active – The project has reached a stable, usable state and is being actively developed. Donate using Liberapay Open in GitHub Codespaces

Multi-arch (linux/amd64, linux/arm64/v8) Mojo dev container.
🔥 All prerequisites installed for Mojo standard library development.

Parent image: glcr.b-data.ch/mojo/base:nightly

Features

  • Git: A distributed version-control system for tracking changes in source code.
  • Git LFS: A Git extension for versioning large files.
  • LLVM (optional, installed): A collection of modular and reusable compiler and toolchain technologies.
  • Mojo (nightly): A programming language for AI developers.
  • Pandoc: A universal markup converter.
  • Python: An interpreted, object-oriented, high-level programming language with dynamic semantics.
  • Zsh: A shell designed for interactive use, although it is also a powerful scripting language.

ℹ️ Regading Magic, see issue #2.

Pre-installed extensions

Table of Contents

Prerequisites

A fork of the Mojo repository:

  1. Owner: Your GitHub username
  2. Repository name: mojo
  3. Untick "Copy the main branch only"

Local: Dev containers require VS Code and either Docker or Podman to be installed.

Web: Codespaces require no installation.

Install

VS Code

Set up Visual Studio Code and install the Remote Development Extension Pack.

Docker

See Install Docker Engine | Docker Docs.

Podman

See Podman Installation | Podman.

Usage

The Mojo dev container is not intended for work on this repository, but rather for Mojo standard library development and behaves in a unique way:

  1. Default mount:
    • source: empty directory
    • target: /home/vscode
    • type: volume
  2. Codespace only mount:
    • source: root of this repository
    • target: /workspaces
    • type: misc
  3. Default path: /home/vscode/projects/modularml/mojo
  4. Default user: vscode
    • uid: 1000 (auto-assigned)
    • gid: 1000 (auto-assigned)
  5. Lifecycle scripts:

To disable the postStartCommand or postAttachCommand, comment out line 8 in ~/.local/bin/dockerSystemPrune.sh or ~/.local/bin/checkForUpdates.sh.

Codespace

  1. Click the <> Code button, then click the Codespaces tab.
    A message is displayed at the bottom of the dialog telling you who will pay for the codespace.
  2. Create your codespace after configuring advanced options:
    • Configure advanced options
      To configure advanced options for your codespace, such as a different machine type or a particular devcontainer.json file:
      • At the top right of the Codespaces tab, select ... and click New with options....
      • On the options page for your codespace, choose your preferred options from the dropdown menus.
      • Click Create codespace.

Creating a codespace for a repository - GitHub Docs

Local/'Remote SSH'

Set OWN_REPOSITORY_URL in devcontainer.json.

Use the Dev Containers: Reopen in Container command from the Command Palette (F1, ⇧⌘P (Windows, Linux Ctrl+Shift+P))

ℹ️ For further information, see Developing inside a Container using Visual Studio Code Remote Development.

Persistence

Data in the following locations is persisted:

  1. The user's home directory (/home/vscode)1
  2. The dev container's workspace (/workspaces)

This is accomplished via a volume (or loop device on Codespaces) and is preconfigured.

Codespaces: A 'Full Rebuild Container' resets the home directory!
ℹ️ This is never necessary unless you want exactly that.

Similar project

What makes this project different:

  1. Multi-arch: linux/amd64, linux/arm64/v8
    ℹ️ Runs on Apple M series using Docker Desktop.
  2. Base image: Debian instead of Ubuntu
  3. Just Python – no Conda / Mamba

Contributing

PRs accepted.

This project follows the Contributor Covenant Code of Conduct.

License

Copyright © 2024 Olivier Benz

Distributed under the terms of the MIT License.

Footnotes

  1. Alternatively for the root user (/root). Use with Docker/Podman in rootless mode.