Skip to content

Commit

Permalink
Minor formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonkurtz-MSFT committed Jan 7, 2025
1 parent 7301c70 commit 8eddf2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions docs/aca/12-optimize-containers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ Our original `Dockerfile` files look like this:
--8<-- "docs/aca/12-optimize-containers/Frontend.Ui.Dockerfile"
```

```shell
cd ~\TasksTracker.ContainerApps
From the TasksTracker.ContainerApps directory, run the following commands:

```shell
docker build -t backend-api-status-quo -f .\TasksTracker.TasksManager.Backend.Api\Dockerfile .
docker build -t backend-svc-status-quo -f .\TasksTracker.Processor.Backend.Svc\Dockerfile .
docker build -t frontend-ui-status-quo -f .\TasksTracker.WebPortal.Frontend.Ui\Dockerfile .
Expand All @@ -77,6 +77,8 @@ For example, the Backend API image is comprised of two images, 451 packages, and

The VS Code Docker extension produces a Dockerfile that's helpful for development but not as ideal for creation of production containers. We can significantly simplify and streamline the files (note that `publish` builds for `Release` by default, so we don't need to declare the configuration). These changes do not immediately impact image size yet.

Create three new files, `Dockerfile.concise` in each of their respective directories:

=== "Concise Backend.API Dockerfile"
```Dockerfile
--8<-- "docs/aca/12-optimize-containers/Backend.Api.Dockerfile.concise"
Expand All @@ -92,7 +94,7 @@ The VS Code Docker extension produces a Dockerfile that's helpful for developmen
--8<-- "docs/aca/12-optimize-containers/Frontend.Ui.Dockerfile.concise"
```

Create three new files, `Dockerfile.concise` in each of their respective directories, then run the following commands from the project root directory to build the concise images. All images will build, but they will continue to essentially be identical to the status quo images.
Run the following commands from the project root directory to build the concise images. All images will build, but they will continue to essentially be identical to the status quo images.

```shell
docker build -t backend-api-concise -f .\TasksTracker.TasksManager.Backend.Api\Dockerfile.concise .\TasksTracker.TasksManager.Backend.Api
Expand All @@ -106,6 +108,8 @@ docker image list

Microsoft and Ubuntu's creator, Canonical, collaborated on the concept of a [chiseled image for .NET](https://learn.microsoft.com/dotnet/core/docker/container-images#scenario-based-images){target=_blank}. Take a general-purpose base image and start chiseling away until you are left with an image that contains nothing more than the bare necessities to run your workload. No shell, no package manager, no bloat.

Create three new files, `Dockerfile.chiseled` in each of their respective directories:

=== "Chiseled Backend.API Dockerfile"
```Dockerfile
--8<-- "docs/aca/12-optimize-containers/Backend.Api.Dockerfile.chiseled"
Expand All @@ -121,7 +125,7 @@ Microsoft and Ubuntu's creator, Canonical, collaborated on the concept of a [chi
--8<-- "docs/aca/12-optimize-containers/Frontend.Ui.Dockerfile.chiseled"
```

Create three new files, `Dockerfile.chiseled` in each of their respective directories, then run the following commands from the project root directory to build the chiseled images:
Run the following commands from the project root directory to build the chiseled images:

```shell
docker build -t backend-api-chiseled -f .\TasksTracker.TasksManager.Backend.Api\Dockerfile.chiseled .\TasksTracker.TasksManager.Backend.Api
Expand Down Expand Up @@ -207,6 +211,8 @@ The Backend API and the Backend Svc projects are all but identical while the Fro
| Backend Svc Concise | 226 MB | 0 MB | | 2 | 451 | 25 |
| Backend Svc Chiseled | 119 MB | 107 MB | 56.6% | 1 | 328 | 2 |

--8<-- "snippets/persist-state.md:module12"

## Review

In this module, we have accomplished two objectives:
Expand Down
2 changes: 1 addition & 1 deletion snippets/persist-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

--8<-- [start:module12]

- Navigate to the root and persist the module to Git.
Navigate to the root and persist the module to Git.

```shell
git add .
Expand Down

0 comments on commit 8eddf2d

Please sign in to comment.