migetpacks automatically detects the language version for your project by checking environment variables, version files, and project configuration files in a defined priority order. If no version is found, a sensible default is used.

Detection Priority by Language

Each language checks sources in the order listed below. The first match wins.

Node.js

PrioritySourceExample
1NODE_VERSION env varNODE_VERSION=20.11.0
2.node-version file20.11.0
3.nvmrc file20
4package.json engines.node"node": ">=20"
-Default22.16.0

Bun

PrioritySourceExample
1BUN_VERSION env varBUN_VERSION=1.1.0
2.bun-version file1.1.0
3bunfig.toml version fieldversion = "1.1.0"
-Default1.3.4

Deno

PrioritySourceExample
1DENO_VERSION env varDENO_VERSION=2.0.0
2.deno-version file2.0.0
3.dvmrc file2.0.0
4deno.json version field"version": "2.0.0"
-Default2.6.1

Ruby

PrioritySourceExample
1RUBY_VERSION env varRUBY_VERSION=3.3.0
2.ruby-version file3.3.0
3Gemfile ruby directiveruby "3.3.0"
-Default3.4.4

Python

PrioritySourceExample
1PYTHON_VERSION env varPYTHON_VERSION=3.12.0
2.python-version file3.12.0
3runtime.txtpython-3.12.0
4uv.lock requires-pythonrequires-python = ">=3.13"
5pyproject.toml requires-pythonrequires-python = ">=3.12"
-Default3.12.8

Go

PrioritySourceExample
1GO_VERSION env varGO_VERSION=1.22.0
2.go-version file1.22.0
3go.mod go directivego 1.22
-Default1.25.0

Rust

PrioritySourceExample
1RUSTUP_TOOLCHAIN env varRUSTUP_TOOLCHAIN=1.80.0
2rust-toolchain file1.80.0
3rust-toolchain.toml channelchannel = "1.80.0"
-Default1.92.0

PHP

PrioritySourceExample
1PHP_VERSION env varPHP_VERSION=8.3
2.php-version file8.3
3composer.json require.php"php": ">=8.2"
-Default8.3

Java

PrioritySourceExample
1JAVA_VERSION env varJAVA_VERSION=21
2.java-version file21
3system.propertiesjava.runtime.version=21
4pom.xml properties<java.version>21</java.version>
-Default21

Kotlin

PrioritySourceExample
1KOTLIN_VERSION env varKOTLIN_VERSION=2.0.0
2.kotlin-version file2.0.0
3gradle.propertieskotlin.version=2.0.0
4build.gradle.kts plugin versionkotlin("jvm") version "2.0.0"
-Default2.1.0

Scala

PrioritySourceExample
1SCALA_VERSION env varSCALA_VERSION=3.4.0
2.scala-version file3.4.0
3build.sbt scalaVersionscalaVersion := "3.4.0"
4project/build.propertiesscala.version=3.4.0
-Default3.5.2

Clojure

PrioritySourceExample
1CLOJURE_VERSION env varCLOJURE_VERSION=1.12.0
2.clojure-version file1.12.0
3project.clj dependency[org.clojure/clojure "1.12.0"]
4deps.edn dependencyorg.clojure/clojure {:mvn/version "1.12.0"}
-Default1.11.1

.NET

PrioritySourceExample
1DOTNET_VERSION env varDOTNET_VERSION=8.0
2global.json SDK version"version": "8.0.100"
3*.csproj TargetFramework<TargetFramework>net8.0</TargetFramework>
-Default8.0

Elixir

PrioritySourceExample
1ELIXIR_VERSION env varELIXIR_VERSION=1.17.0
2.elixir-version file1.17.0
3.tool-versions (asdf)elixir 1.17.0
-Default1.18.4

Version Normalization

migetpacks normalizes version constraints found in project files to Docker-compatible image tags. The following transformations are applied:

Prefix Removal

The v prefix is stripped from versions:
v20.11.0  ->  20.11.0

Semver Range Operators

Operators like >=, ^, ~, >, <, and = are removed, and the base version is extracted:
>=18       ->  18
^20.0.0    ->  20.0
~20.0.0    ->  20.0
>18        ->  18
For full semver versions with operators, the patch version is dropped:
^20.11.1   ->  20.11
~3.12.0    ->  3.12

Wildcard Patterns

The .x and .* patterns are reduced to the major version:
20.x       ->  20
22.*       ->  22

OR Alternatives

When a version string contains || separated alternatives, the highest major version is selected:
20.x || 22.x || 24.x   ->  24
>=18 || >=20            ->  20

Plain Versions

Explicit versions without operators are kept as-is, since Docker Hub has tags for all common formats:
20         ->  20
20.11      ->  20.11
20.11.0    ->  20.11.0
3.12.8     ->  3.12.8