From 3433f24f4f8cf8ca302a4a80350a89df204aa24c Mon Sep 17 00:00:00 2001 From: Pradumna Saraf Date: Thu, 6 Nov 2025 10:01:09 +0530 Subject: [PATCH 1/3] docs: Update Deno guide to include Docker Hardened Images --- content/guides/deno/_index.md | 2 +- content/guides/deno/containerize.md | 44 +++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/content/guides/deno/_index.md b/content/guides/deno/_index.md index a864479ed9a..11f5b0b8912 100644 --- a/content/guides/deno/_index.md +++ b/content/guides/deno/_index.md @@ -10,7 +10,7 @@ params: time: 10 minutes --- -The Deno getting started guide teaches you how to create a containerized Deno application using Docker. In this guide, you'll learn how to: +The Deno getting started guide teaches you how to create a containerized Deno application using Docker. > **Acknowledgment** > diff --git a/content/guides/deno/containerize.md b/content/guides/deno/containerize.md index 70175896df4..a603b8bc3cd 100644 --- a/content/guides/deno/containerize.md +++ b/content/guides/deno/containerize.md @@ -65,8 +65,42 @@ await app.listen({ port: 8000 }); ## Create a Dockerfile -In the Dockerfile, you'll notice that the `FROM` instruction uses `denoland/deno:latest` -as the base image. This is the official image for Deno. This image is [available on the Docker Hub](https://hub.docker.com/r/denoland/deno). +Before creating a Dockerfile, you need to choose a base image. You can either use the [Deno Docker Official Image](https://hub.docker.com/r/denoland/deno) or a Docker Hardened Image (DHI) from the [Hardened Image catalog](https://hub.docker.com/hardened-images/catalog). + +Choosing DHI offers the advantage of a production-ready image that is lightweight and secure. For more information, see [Docker Hardened Images](https://docs.docker.com/dhi/). + +{{< tabs >}} +{{< tab name="Using Docker Hardened Images" >}} +Docker Hardened Images (DHIs) are available for Deno on [Docker Hub](https://hub.docker.com/hardened-images/catalog/dhi/deno). Unlike using the Docker Official Image, you must first mirror the Deno image into your organization and then use it as your base image. Follow the instructions in the [DHI quickstart](/dhi/get-started/) to create a mirrored repository for Deno. + +Mirrored repositories must start with `dhi-`, for example: `FROM /dhi-deno:`. In the following Dockerfile, the `FROM` instruction uses `/dhi-deno:1` as the base image. + +```dockerfile +# Use the DHI Deno image as the base image +FROM /dhi-deno:1 + +# Set the working directory +WORKDIR /app + +# Copy server code into the container +COPY server.ts . + +# Set permissions (optional but recommended for security) +USER deno + +# Expose port 8000 +EXPOSE 8000 + +# Run the Deno server +CMD ["run", "--allow-net", "server.ts"] +``` + +{{< /tab >}} +{{< tab name="Using the official image" >}} + +Using the Docker Official Image is straightforward. In the following Dockerfile, you'll notice that the `FROM` instruction uses `denoland/deno:latest` as the base image. + +This is the official image for Deno. This image is [available on the Docker Hub](https://hub.docker.com/r/denoland/deno). ```dockerfile # Use the official Deno image @@ -88,7 +122,10 @@ EXPOSE 8000 CMD ["run", "--allow-net", "server.ts"] ``` -Aside from specifying `denoland/deno:latest` as the base image, the Dockerfile: +{{< /tab >}} +{{< /tabs >}} + +In addition to specifying the base image, the Dockerfile also: - Sets the working directory in the container to `/app`. - Copies `server.ts` into the container. @@ -139,6 +176,7 @@ Related information: - [.dockerignore file](/reference/dockerfile.md#dockerignore-file) - [Docker Compose overview](/manuals/compose/_index.md) - [Compose file reference](/reference/compose-file/_index.md) + - [Docker Hardened Images](/dhi/) ## Next steps From e3406827143e4917827110ee5c7b832553789b7d Mon Sep 17 00:00:00 2001 From: Pradumna Saraf Date: Fri, 14 Nov 2025 11:44:09 +0530 Subject: [PATCH 2/3] Update content/guides/deno/containerize.md Co-authored-by: Craig Osterhout --- content/guides/deno/containerize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/deno/containerize.md b/content/guides/deno/containerize.md index a603b8bc3cd..e55d6aa06c4 100644 --- a/content/guides/deno/containerize.md +++ b/content/guides/deno/containerize.md @@ -73,7 +73,7 @@ Choosing DHI offers the advantage of a production-ready image that is lightweigh {{< tab name="Using Docker Hardened Images" >}} Docker Hardened Images (DHIs) are available for Deno on [Docker Hub](https://hub.docker.com/hardened-images/catalog/dhi/deno). Unlike using the Docker Official Image, you must first mirror the Deno image into your organization and then use it as your base image. Follow the instructions in the [DHI quickstart](/dhi/get-started/) to create a mirrored repository for Deno. -Mirrored repositories must start with `dhi-`, for example: `FROM /dhi-deno:`. In the following Dockerfile, the `FROM` instruction uses `/dhi-deno:1` as the base image. +Mirrored repositories must start with `dhi-`, for example: `FROM /dhi-deno:`. In the following Dockerfile, the `FROM` instruction uses `/dhi-deno:2` as the base image. ```dockerfile # Use the DHI Deno image as the base image From b9d93b8e9b9bc54e45a966e18603d3625ca2af51 Mon Sep 17 00:00:00 2001 From: Pradumna Saraf Date: Fri, 14 Nov 2025 11:44:15 +0530 Subject: [PATCH 3/3] Update content/guides/deno/containerize.md Co-authored-by: Craig Osterhout --- content/guides/deno/containerize.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/deno/containerize.md b/content/guides/deno/containerize.md index e55d6aa06c4..c59273004ef 100644 --- a/content/guides/deno/containerize.md +++ b/content/guides/deno/containerize.md @@ -77,7 +77,7 @@ Mirrored repositories must start with `dhi-`, for example: `FROM /dhi-deno:1 +FROM /dhi-deno:2 # Set the working directory WORKDIR /app