Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

C# .NET hello world

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.

Workflow

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

Deployment

Requirements

To complete the actions presented below, you must have:

Building the image

  1. 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.

  1. Copy the namespace endpoint (in this case, rg.fr-par.scw.cloud/hello-dotnet).

  2. 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.

  1. 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 .
  2. Tag and push the image to the registry namespace:

    docker push rg.fr-par.scw.cloud/hello-dotnet/dotnet:v1

Deploying the image

In a terminal, run the following command to create a Serverless Containers namespace:

```bash
scw container namespace create name=hello
```
The namespace information displays.
  1. Copy the namespace ID.

  2. 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.

  3. Copy the DomainName (endpoint) to test your container, you can put the endpoint in your web browser for testing.