In the previous article, we created a docker-compose.yml file to make it a project so that we can run it. In this article, we will configure the image created in the previous article so that it can be used in Azure.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6RPfQ6JL7MXsBWTr3DLc82%2F01add6f04d65a2153cc9b13736aa04ea%2Fchander-r-z4WH11FMfIQ-unsplash.jpg&w=3840&q=75)
Additional Visual Studio Code extensions
The following extensions are enabled in the Visual Studio Code used at hand.
This allows images already created in Visual Studio to be deployed in Azure; an Azure Container Registry should be pre-created in Azure to manage container images.
Source code changes
The current playwright application is launched using port 3000 as shown below.
const port = 3000
This can be set via environment variables.
const port = process.env.PORT || 3000
This allows startup using port 3000 by default and startup in a production environment, etc., by specifying the port number in the ENV.
Enhance the image you use.
The image shown in the Docker extension is now uploaded to Azure's container registry. Note that for the 0.1.0 version of the image, the tag "latest" has been set.
First, select the image to be uploaded and right-click to bring up the menu. Then push.. will be displayed.
![playwright12.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2y5QUg9xjw0tkdhmVVo5Qr%2F42d2828939bf51668b5ea6a64b0118b8%2Fplaywright12.png&w=3840&q=75)
After a few moments, a list of available container registries will be displayed. In this case, sitecorejp is specified.
![playwright13.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F7ept0qp9iFM2PrhWLn43IX%2Fcceba8a12d084235c5cafa1a35bce14f%2Fplaywright13.png&w=3840&q=75)
Specify the name of the image. In this case, we will execute the image as is. The image will be uploaded for a while.
![playwright14.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2SEu2gLaYG2uI8szCek6kw%2Fa444127bbbe721d0bb04823b406bc517%2Fplaywright14.png&w=3840&q=75)
Confirm that the image has been uploaded on the Azure administration page.
![playwright15.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1vgVm6LDt5rTEdOJuHTBNl%2F4ee9db9bf46057f8885ba99b0dd2c41c%2Fplaywright15.png&w=3840&q=75)
Launch Azure Web App
Select Web app for Containers since we will be using Docker containers.
![playwright16.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F3T6l44D55Hr0lHLWAptjiX%2F89495a7ab86e05cb85d2df94aff51684%2Fplaywright16.png&w=3840&q=75)
The following points should be checked as part of the web application configuration.
- Public is a Docker container
- Operating system is Linux
- Data center and Linux plans are tailored accordingly
Navigate to the Docker settings tab and select the image you have just uploaded.
![playwright17.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2uIv8WnlYVGgQ65KI4cwnr%2F9d913ba97c89d2c91d8c20b82b4698b0%2Fplaywright17.png&w=3840&q=75)
The rest of the default settings should proceed as is. You are now ready to start the container using the image.
However, since the default is to start using port 3000, use the application configuration to change the port. From the container configuration, select New Application Settings and specify 443 as PORT.
![playwright18.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2MwfNcfT6vqBhl4CKAfai7%2Fa2e3309c668e32d50de57972a9540113%2Fplaywright18.png&w=3840&q=75)
Operation check
Please access the site you have activated. After a few moments, you will see the default message as shown below.
![playwright19.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6RsaGl3RT3jOzlmEjpxkz3%2F24a8d171b0bc137d0de2a6c6e3fab2e1%2Fplaywright19.png&w=3840&q=75)
API to access the site, the screenshot is successfully retrieved.
![playwright20.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1xEiXaeDP2WUnsU1WqkuiL%2Fc63513b0cdddad83c37bd17b2b97848a%2Fplaywright20.png&w=3840&q=75)
Summary
The containerized image was registered in the Azure container repository, and the Web App using the container was launched using the image. The values that can be managed in .env can be set like port numbers, so if you want to change the size of the screen, it is possible to get screenshots of different sizes using the image by referring to the .env setting items. If you want to change the size of the screen, you can set it up by referring to the .env settings.