diff --git a/README.md b/README.md index ff2d5b9..607db9b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,26 @@ https://hub.docker.com/r/codercom/enterprise-base. The tag is taken from the filename of the Dockerfile. For example, `base/ubuntu.Dockerfile` is under the `ubuntu` tag. +### Ubuntu Version-Specific Tags + +For Ubuntu-based images, additional version-specific tags are automatically created +to provide stability and prevent unexpected breaking changes when the base Ubuntu +version is updated. + +Currently supported Ubuntu versions: + +- `ubuntu-24.04` - Ubuntu 24.04 LTS + +Example usage: + +```yaml +# Use a specific Ubuntu version to ensure stability +image: codercom/enterprise-base:ubuntu-24.04 +``` + +This prevents workspaces from breaking when the base Ubuntu version is updated +in the main `ubuntu` tag. + ## Contributing See our [contributing guide](.github/CONTRIBUTING.md). diff --git a/images/base/ubuntu.Dockerfile b/images/base/ubuntu.Dockerfile index ac4d0c3..ce05a91 100644 --- a/images/base/ubuntu.Dockerfile +++ b/images/base/ubuntu.Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:noble +FROM ubuntu:24.04 SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive diff --git a/scripts/build_images.sh b/scripts/build_images.sh index 2033375..2c8e064 100755 --- a/scripts/build_images.sh +++ b/scripts/build_images.sh @@ -101,9 +101,42 @@ for image in "${IMAGES[@]}"; do continue fi + # Build tag arguments for depot build command + tag_args=("--tag=$image_ref") + + # For Ubuntu images, add version-specific tags + if [ "$TAG" = "ubuntu" ]; then + # Extract Ubuntu version from Dockerfile + ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) + if [ -n "$ubuntu_base" ]; then + # Extract Ubuntu version number + # Currently only Ubuntu 24.04 is supported + case "$ubuntu_base" in + "24.04") + ubuntu_version="24.04" + ;; + *) + # Unsupported Ubuntu version - skip version-specific tags + ubuntu_version="" + if [ $QUIET = false ]; then + echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 is currently supported." >&2 + fi + ;; + esac + + # Add version-specific tag + if [ -n "$ubuntu_version" ]; then + tag_args+=("--tag=codercom/enterprise-$image:ubuntu-$ubuntu_version") + if [ $QUIET = false ]; then + echo "Adding Ubuntu version tag: ubuntu-$ubuntu_version" >&2 + fi + fi + fi + fi + run_trace $DRY_RUN depot build --project "gb3p8xrshk" --load --platform linux/arm64,linux/amd64,linux/arm/v7 --save --metadata-file="build_${image}.json" \ "${docker_flags[@]}" \ "$image_dir" \ --file="$image_path" \ - --tag="$image_ref" \| indent + "${tag_args[@]}" \| indent done diff --git a/scripts/push_images.sh b/scripts/push_images.sh index 4046dcb..8b736ee 100755 --- a/scripts/push_images.sh +++ b/scripts/push_images.sh @@ -107,4 +107,35 @@ for image in "${IMAGES[@]}"; do run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$image_ref" "$build_id" run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$image_ref_date" "$build_id" run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "codercom/enterprise-${image}:latest" "$build_id" + + # For Ubuntu images, also push version-specific tags + if [ "$TAG" = "ubuntu" ]; then + # Extract Ubuntu version from Dockerfile + ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) + if [ -n "$ubuntu_base" ]; then + # Extract Ubuntu version number + # Currently only Ubuntu 24.04 is supported + case "$ubuntu_base" in + "24.04") + ubuntu_version="24.04" + ;; + *) + # Unsupported Ubuntu version - skip version-specific tags + ubuntu_version="" + if [ $QUIET = false ]; then + echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 is currently supported." >&2 + fi + ;; + esac + + # Push version-specific tag + if [ -n "$ubuntu_version" ]; then + version_tag="codercom/enterprise-$image:ubuntu-$ubuntu_version" + run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$version_tag" "$build_id" + if [ $QUIET = false ]; then + echo "Pushed Ubuntu version tag: ubuntu-$ubuntu_version" >&2 + fi + fi + fi + fi done