Skip to content

Instantly share code, notes, and snippets.

@mkpanq
Last active August 3, 2025 11:44
Show Gist options
  • Select an option

  • Save mkpanq/53c24c1f9c2a02beea24df3bc2c789a6 to your computer and use it in GitHub Desktop.

Select an option

Save mkpanq/53c24c1f9c2a02beea24df3bc2c789a6 to your computer and use it in GitHub Desktop.
Dockerfile with the newest asdf installed, which takes .tool-version from the current folder, installs plugins, and all versions.
# syntax=docker/dockerfile:1
FROM ubuntu:latest
LABEL maintainer='Marek Pankowski <mkpanq.com>'
LABEL last-update='2025-08-03'
SHELL ["/bin/bash", "-l", "-c"]
# Be sure to install the proper version of asdf
# Available version type for each tag:
# linux-arm64
# linux-386
# linux-amd64
# darwin-amd64
# darwin-arm64
ARG PACKAGE_VERSION="linux-arm64"
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
curl \
git \
tar \
&& a_pt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /root
RUN tag=$(curl --silent "https://api.github.com/repos/asdf-vm/asdf/tags" | jq -r '.[0].name') \
&& curl -L https://github.com/asdf-vm/asdf/releases/download/$tag/asdf-$tag-${PACKAGE_VERSION}.tar.gz --output asdf-arm64.tar.gz \
&& tar -xzf asdf-arm64.tar.gz \
&& rm -rf asdf-arm64.tar.gz
RUN mv asdf /usr/local/bin && chmod +x /usr/local/bin/asdf
ENV PATH="/usr/local/bin:${PATH}"
COPY .tool-versions /root/.tool-versions
RUN for tool in $(awk '{print $1}' < .tool-versions); do \
if ! asdf plugin list | grep -q "^$tool\$"; then \
asdf plugin add $tool; \
fi; \
done && \
asdf install && \
asdf reshim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment