Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

67 Commits

Folders and files

Repository files navigation

openSUSE Dev Container Templates

Release Templates & Generate Documentation Test Templates Validate Templates

This repository contains Dev Container Templates based on openSUSE Linux distro. The containers are suitable for development and programming in openSUSE.

Template Description
opensuse openSUSE Leap or Tumbleweed with development tools,
agama openSUSE + Agama installer development (Rust, Ruby, React, Kiwi)

For both it is possible to enable optional Gemini and Claude support with SUSE default authentication configuration.

Advantages

Developing in a containerized sandbox provides many useful advantages:

  • All needed development tools are automatically installed.
  • Ensures all developers have the same environment.
  • You can develop from different version or from a completely different distribution (or even from Windows using WSL containers).
  • The sandbox is useful when running AI code assisting tools.
  • If you mess up the development system you can just rebuild the container and start from scratch.
  • Want to develop on openSUSE Tumbleweed instead of Leap? Just switch the base system image and rebuild the container!

Usage

The dev container can be either used in Visual Studio Code or with the Devcontainer CLI.

Visual Studio Code

  1. From the command palette (F1 or Ctrl+Shift+P) select Dev Containers: Add Dev Container Configuration Files
  2. Select Add configuration to workspace (the user data folder is not supported, the installation would fail there).
  3. Then insert either the ghcr.io/lslezak/suse-devcontainer/opensuse or ghcr.io/lslezak/suse-devcontainer/agama name of the template depending which container you want to use.
  4. Select the base product used for the new container, either openSUSE Leap or openSUSE Tumbleweed.
  5. If you selected the Agama container then select which Agama components you want to develop. The full (all-in-one) container image is quite big, almost 3GB. If you want to work only on a particular Agama part (like the Web frontend) you can select only that part and save some disk space.
  6. Then you can select some community features, but be careful, many of them support only few Linux distributions. Quite often they are written only for Ubuntu or Fedora and do not support openSUSE. (They usually install additional packages using apt or dnf without zypper support.) It's recommended to just skip this without selecting any additional features.
  7. Then the container files will be generated to the .devcontainer folder. You can inspect them or possibly modify to fit your needs. See the Customization section below.
  8. After opening the folder in VSCode click Open in Container in the bottom right corner or manually select Dev Containers: Rebuild and Open in Container from the command palette.
  9. Enjoy your openSUSE Dev Container and have a lot of fun! 😃

Devcontainer CLI

Install the devcontainer CLI from npm (requires Node.js), the devcontainer command is installed to ~/.local/bin:

sudo zypper install npm-default
npm install --global --prefix ~/.local @devcontainers/cli

Alternatively run it without installing via npx @devcontainers/cli.

Apply a template in the current directory:

devcontainer templates apply --workspace-folder . \
  --template-id ghcr.io/lslezak/suse-devcontainer/opensuse \
  --template-args '{"imageVariant": "tumbleweed"}'
devcontainer templates apply --workspace-folder . \
  --template-id ghcr.io/lslezak/suse-devcontainer/agama \
  --template-args '{"imageVariant": "leap:16.1", "agamaVariant": "all-in-one"}'

Devcontainer parts

The devcontainer contains several parts in the .devcontainer directory:

  • Containerfile - the main container image definition, defines what is inside
  • devcontainer.json - defines how to run the container, which VSCode extensions should be installed, installs devcontainer features (small shareable parts of the container configuration)
  • features/* - implement a small shareable self-contained container feature, the install.sh is run during image build (basically extends the Containerfile), the devcontainer-feature.json file extends the base devcontainer.json file.

Customization

For basic customization you can change these values:

  • Enable/disable the features in the devcontainer.json file
  • Change the list of installed VSCode extensions
  • Configure hooks
  • Install additional packages in Containerfile (see the EXTRA_PACKAGES argument)

Keeping the configuration out of the project

Exclude it locally and optionally track it in a separate repository:

echo "/.devcontainer/" >> .git/info/exclude
cd .devcontainer
git init -b main && git add . && git commit -m "Dev container configuration"
gh repo create <project>-devcontainer --private --source . --push

To restore it in another checkout:

git clone git@github.com:<user>/<project>-devcontainer.git .devcontainer
echo "/.devcontainer/" >> .git/info/exclude

Development

  • Template options are substituted for ${templateOption:<option>} in the template files.
  • Each template has its own copy of the features, the shared Gemini and Claude features must be identical (checked by the Validate workflow).

Build and test a template (requires the devcontainer CLI, jq and Podman or CONTAINER_ENGINE set):

test/smoke-test.sh opensuse imageVariant=tumbleweed

Releasing

  1. Increase the version in devcontainer-template.json.
  2. Run the Release workflow, it publishes the templates to ghcr.io/lslezak/suse-devcontainer/<template-id> and opens a pull request with the generated documentation.
  3. After the first release make the packages public in the GitHub settings.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages