Skip to content

Commit 6ec00d7

Browse files
author
Phil Stollery
committed
container and image fixes
1 parent 956874c commit 6ec00d7

File tree

5 files changed

+6
-55
lines changed

5 files changed

+6
-55
lines changed

DockerfileProducts

-20
This file was deleted.

DockerfileStore

-20
This file was deleted.

Store/Components/Pages/Products.razor

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ else
3333
@foreach (var product in products)
3434
{
3535
<tr>
36-
<td><img height="80" width="80" src="@imagePrefix/@product.ImageUrl" /></td>
36+
<!-- Simulating images being hosted on a CDN -->
37+
<td><img height="80" width="80" src="https://raw.githubusercontent.com/MicrosoftDocs/mslearn-dotnet-cloudnative/main/dotnet-docker/Products/wwwroot/images/@product.ImageUrl" /></td>
3738
<td>@product.Name</td>
3839
<td>@product.Description</td>
3940
<td>@product.Price</td>
@@ -45,13 +46,10 @@ else
4546

4647
@code {
4748
private List<Product>? products;
48-
private string imagePrefix = string.Empty;
4949

5050
protected override async Task OnInitializedAsync()
5151
{
5252
// Simulate asynchronous loading to demonstrate streaming rendering
53-
await Task.Delay(500);
54-
imagePrefix = Configuration["ImagePrefix"];
5553
products = await ProductService.GetProducts();
5654
}
5755

Store/appsettings.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
},
99
"AllowedHosts": "*",
1010
"ProductEndpoint": "http://localhost:5200",
11-
"ProductEndpointHttps": "https://localhost:5200",
12-
"ImagePrefix": "http://localhost:5200/images"
11+
"ProductEndpointHttps": "https://localhost:5200"
1312
}

docker-compose.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,15 @@ version: '3.4'
33
services:
44

55
frontend:
6-
image: storeimage
7-
build:
8-
context: .
9-
dockerfile: DockerfileStore
6+
image: store:latest
107
environment:
118
- ProductEndpoint=http://backend:8080
12-
- ImagePrefix=http://localhost
9+
- ConnectionStrings:AppConfig=[PASTE CONNECTION STRING HERE]
1310
ports:
1411
- "32000:8080"
1512
depends_on:
1613
- backend
1714
backend:
18-
image: productservice
19-
build:
20-
context: .
21-
dockerfile: DockerfileProducts
15+
image: products:latest
2216
ports:
2317
- "32001:8080"

0 commit comments

Comments
 (0)