https://github.com/jrosco/docker-container-asdf/
7.2K
asdf-vm base imagesWorks with asdf >=0.16.0
This repository contains base Docker images tailored for the versatile version manager tool, asdf-vm. These base images are designed with a flexible ONBUILD feature, enabling the creation of specialized images pre-equipped with predefined asdf plugins.
The base image Dockerfile provided here serves as a fundamental building block. It includes essential configurations to set up asdf-vm along with necessary tools like Git, curl, and bash within an Linux environment. An ONBUILD directive is employed to facilitate the automatic installation of specified asdf plugins and versions when building new images based on this template.
Examples of other Dockerfiles demonstrate how these base images can be utilized to construct specialized images for different tools or software stacks. By leveraging the base image and utilizing a docker-compose file, users can easily set up and install asdf plugins as per their requirements.
To make this your own repository, you can fork this repo and update the following environment variables to your liking.
# labels
NAME="asdf-vm"
MAINTAINER="jrosco"
DESCRIPTION="asdf version manager toolset"
URL="https://github.com/jrosco/docker-container-asdf"
REPOSITORY=$URL
# docker registries
ASDF_REGISTRY_BASE="ghcr.io/jrosco/$NAME"
ASDF_REGISTRY_TOOLSET="$ASDF_REGISTRY_BASE-toolsets"
ASDF_IMAGE_TAG="alpine3-v0.19.0"
PACKAGE_NAME="helm helmfile helm-diff"
An example is showcased using Helm packages within an Alpine Linux environment and other examples found in the toolset-docker-images directory.
docker-compose.yml:
services:
alpine:
image: ${ASDF_REGISTRY_TOOLSET}/helm:build
build:
context: .
dockerfile: Dockerfile
args:
asdf_image: "${ASDF_REGISTRY_BASE}:${ASDF_IMAGE_TAG}"
packages: "${PACKAGE_NAME}"
platforms:
- "linux/amd64"
Example Dockerfile and build:
ARG asdf_image="ghcr.io/jrosco/asdf-vm:alpine"
FROM $asdf_image
docker build --platform linux/amd64 \
--build-arg \
packages="awscli:latest:set helmfile:latest:set helm:latest:set kustomize:latest:set" \
--build-arg \
asdf_image="ghcr.io/jrosco/asdf-vm:alpine3-v0.19.0" \
-t helm-toolset:alpine .
docker run -it helm-toolset:alpine asdf info
docker run -it helm-toolset:alpine asdf current
--build-argEach Dockerfile utilizes the following build arguments:
asdf_image: The base image to use for the build. This should be one of the base images provided in the base-images directory.packages: A list of asdf plugins to install. These should be space-separated and match the names of the plugins in the asdf-community GitHub repositorypackages support the following formats
| Format | Description |
|---|---|
helm | Install the plugins repo details only (no versions downloaded) |
helm:3.10.3 | Install plugin (if not present) and download helm version 3.10.3 |
helm:3.10.3:set | Install plugin (if not present) and download helm version 3.10.3 and set this as the default version in .tool-versions |
helm:latest | Install plugin (if not present) and download latest version of helm |
The asdf_image and packages arguments are optional. If not provided, the build will default to installing the latest version of asdf and no plugins.
When building toolset images, use a consistent tagging strategy for easy identification and version management. The docker-compose.yaml files in the toolset-docker-images directory demonstrate a multi-tag approach using variables from .env:
tags:
- "${ASDF_REGISTRY_TOOLSET}/toolset:latest" # Generic latest
- "${ASDF_REGISTRY_TOOLSET}/toolset:alpine-${ALPINE_VERSION}-${ASDF_VERSION}" # OS + ASDF version
- "${ASDF_REGISTRY_TOOLSET}/toolset:alpine-${ALPINE_MAJOR_VERSION}.${ALPINE_MINOR_VERSION}" # OS major.minor
- "${ASDF_REGISTRY_TOOLSET}/toolset:alpine-${ALPINE_VERSION}-${ASDF_VERSION}-build${BUILD_NUMBER}" # Full with build #
Tag components:
alpine / debian — Base operating systemALPINE_VERSION / DEBIAN_VERSION — Full OS version (e.g., 3.20.0, 12.7)ASDF_VERSION — asdf version (e.g., v0.13.0)BUILD_NUMBER — Build iteration counterTagging recommendations:
v1.0.0) for toolset releaseslatest to point to the most recent stable release.tool-versions File on BuildYou can add your own .tool-versions file, for example:
package_name1 version_number
package_name2 version_number
Naming the file .tool-versions will automatically detect the file and COPY it to the image on build.
To add a custom file (e.g., using a different name), you need to use the Docker COPY command and set ASDF's environment variable correctly:
WORKDIR /tmp/ # Only required if you want to put the file in a different location from the default `/asdf/`
ENV ASDF_TOOL_VERSIONS_FILENAME=custom-tool-version
COPY custom-tool-version ./
RUN bash /init/install-asdf-package
See the asdf reference for more details.
To get started, follow these steps:
ONBUILD directives, add or remove packages, and adjust versions as required.Contributions to enhance or expand the existing base images or examples are welcome. Feel free to submit pull requests, suggest improvements, or report issues in the repository.
MIT License
See LICENSE to see the full text.
Content type
Image
Digest
sha256:347aaed14…
Size
95.9 MB
Last updated
2 months ago
docker pull asdfvm/asdf:debian