This example demonstrates the deployment of a simple C# http service on Scaleway Serverless Containers.
For this example, we will use the CLI to deploy the container, but you can use other methods.
Here are the different steps we are going to proceed:
- Quick set-up of Container Registry to host our .NET container
- Deploy the Serverless Container
- Test the container
To complete the actions presented below, you must have:
- installed and configured the Scaleway CLI
- installed Docker to build the image
-
Run the following command in a terminal to create Container Registry namespace to store the image:
scw registry namespace create name=hello-dotnet
The registry namespace information displays.
-
Copy the namespace endpoint (in this case,
rg.fr-par.scw.cloud/hello-dotnet). -
Log into the Container Registry namespace you created using Docker:
docker login rg.fr-par.scw.cloud/hello-dotnet -u nologin --password-stdin <<< "$SCW_SECRET_KEY"
At this point, you have correctly set up Docker to be able to push your image online.
-
In a terminal, access this directory (containing the Dockerfile), and run the following command to build and tag the image:
docker build --platform linux/amd64 -t rg.fr-par.scw.cloud/hello-dotnet/dotnet:v1 . -
Tag and push the image to the registry namespace:
docker push rg.fr-par.scw.cloud/hello-dotnet/dotnet:v1
In a terminal, run the following command to create a Serverless Containers namespace:
```bash
scw container namespace create name=hello
```
The namespace information displays.
-
Copy the namespace ID.
-
Run the following command to create and deploy the container:
scw container container create namespace-id=<PREVIOUS_NAMESPACE_ID> name=hello registry-image=rg.fr-par.scw.cloud/hello-dotnet/dotnet:v1
The container information displays.
-
Copy the DomainName (endpoint) to test your container, you can put the endpoint in your web browser for testing.