Skip to content

Add Ubuntu version-specific tags for Docker images #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion images/base/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:noble
FROM ubuntu:24.04

SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
Expand Down
35 changes: 34 additions & 1 deletion scripts/build_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 31 additions & 0 deletions scripts/push_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading