Edition 0 Updated to asp. Net core 0


Using a single Docker container image to run multiple different API Gateway / BFF



Yüklə 11,82 Mb.
Pdf görüntüsü
səhifə153/288
tarix12.07.2023
ölçüsü11,82 Mb.
#136458
1   ...   149   150   151   152   153   154   155   156   ...   288
NET-Microservices-Architecture-for-Containerized-NET-Applications

Using a single Docker container image to run multiple different API Gateway / BFF 
container types 
In eShopOnContainers, we’re using a single Docker container image with the Ocelot API Gateway but 
then, at run time, we create different services/containers for each type of API-Gateway/BFF by 
providing a different configuration.json file, using a docker volume to access a different PC folder for 
each service. 
Figure 6-33. Reusing a single Ocelot Docker image across multiple API Gateway types 
In eShopOnContainers, the “Generic Ocelot API Gateway Docker Image” is created with the project 
named ‘OcelotApiGw’ and the image name “eshop/ocelotapigw” that is specified in the docker
-
compose.yml file. Then, when deploying to Docker, there will be four API-Gateway containers created 
from that same Docker image, as shown in the following extract from the docker-compose.yml file. 
mobileshoppingapigw:
image:
eshop/ocelotapigw:${TAG:-latest}


173 
CHAPTER 5 | Designing and Developing Multi-Container and Microservice-Based .NET Applications 
build:
context:
.
dockerfile:
src/ApiGateways/ApiGw-Base/Dockerfile
mobilemarketingapigw:
image:
eshop/ocelotapigw:${TAG:-latest}
build:
context:
.
dockerfile:
src/ApiGateways/ApiGw-Base/Dockerfile
webshoppingapigw:
image:
eshop/ocelotapigw:${TAG:-latest}
build:
context:
.
dockerfile:
src/ApiGateways/ApiGw-Base/Dockerfile
webmarketingapigw:
image:
eshop/ocelotapigw:${TAG:-latest}
build:
context:
.
dockerfile:
src/ApiGateways/ApiGw-Base/Dockerfile
Additionally, as you can see in the following docker-compose.override.yml file, the only difference 
between those API Gateway containers is the Ocelot configuration file, which is different for each 
service container and it’s specified at run time through a Docker volume.
mobileshoppingapigw:
environment:

Yüklə 11,82 Mb.

Dostları ilə paylaş:
1   ...   149   150   151   152   153   154   155   156   ...   288




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin