Last active
August 3, 2025 11:44
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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