|
| 1 | +--- |
| 2 | +title: Hosting a web app with Serverless Containers |
| 3 | +description: This page provides guidelines on how to host and deploy dynamic web applications using Scaleway Serverless Containers |
| 4 | +tags: deploy host website webapp react next containerize application docker dockerfile |
| 5 | +products: |
| 6 | + - containers |
| 7 | + - container-registry |
| 8 | +dates: |
| 9 | + validation: 2025-10-06 |
| 10 | + posted: 2025-10-06 |
| 11 | + validation_frequency: 12 |
| 12 | +difficulty: beginner |
| 13 | +usecase: |
| 14 | + - application-hosting |
| 15 | + - deploy-external-software |
| 16 | + - website-hosting |
| 17 | +ecosystem: |
| 18 | + - third-party |
| 19 | +--- |
| 20 | + |
| 21 | +import Requirements from '@macros/iam/requirements.mdx' |
| 22 | + |
| 23 | + |
| 24 | +<Requirements /> |
| 25 | + |
| 26 | +- A Scaleway account logged into the [console](https://console.scaleway.com) |
| 27 | +- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization |
| 28 | +- Installed [Docker](https://docs.docker.com/get-started/get-docker/) or [Docker Egine](https://docs.docker.com/engine/install/) |
| 29 | +- [Created a Scaleway Container Registry namespace](/container-registry/how-to/create-namespace/) and [logged into it](/container-registry/how-to/connect-docker-cli/) |
| 30 | + |
| 31 | +## Create and host a simple HTML static page |
| 32 | + |
| 33 | +To host a static HTML page on Serverless Containers, you first need to create a simple HTML page that will serve as your website. Next, you will write a Dockerfile to containerize your application, specifying how your HTML file should be served. You will then build the container image locally, and push it to the [Scaleway Container Registry](/container-registry/), before deploying it to [Scaleway Serverless Containers](/serverless-containers/). |
| 34 | + |
| 35 | +1. In a terminal, run the command below to create a new folder and access it: |
| 36 | + |
| 37 | + ```bash |
| 38 | + mkdir my-static-website |
| 39 | + cd my-static-website |
| 40 | + ``` |
| 41 | + |
| 42 | +2. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +3. In the same folder, create a new `dockerfile` file and add the following code to it: |
| 47 | + |
| 48 | + ```dockerfile |
| 49 | + ``` |
| 50 | + |
| 51 | +4. Run the command below to build, tag, and push your image to the Scaleway Container registry: |
| 52 | + |
| 53 | + ```bash |
| 54 | + docker build \ |
| 55 | + --platform linux/amd64 \ |
| 56 | + --push \ |
| 57 | + -t <CONTAINER_REGISTRY_ENDPOINT>/my-static-website:latest . |
| 58 | + ``` |
| 59 | + |
| 60 | + <Message type="note"> |
| 61 | + You can find your Container Registry endpoint in the **Settings** tab of your Container Registry Endpoint in the [Scaleway console](https://console.scaleway.com/registry/namespaces) |
| 62 | + </Message> |
| 63 | + |
| 64 | +5. [Deploy a Serverless Container](/serverless-containers/how-to/deploy-container/) with the following parameters: |
| 65 | + |
| 66 | + - **Registry**: Scaleway Container Registry |
| 67 | + - **Registry namespace**: the Container Registry namespace you pushed your image to. |
| 68 | + - **Container port**: `8O` as it is the [port](/serverless-containers/reference-content/port-parameter-variable/) exposed in the dockerfile. |
| 69 | + - **Resources**: `100 mVCPU` and `256 MB` memory |
| 70 | + - **Autoscaling**: set a minimum scale of `1` to avoid [cold starts](/serverless-containers/concepts/#cold-start) (optional). |
| 71 | + |
| 72 | + The deployment of your container can take up to a minute to complete. |
| 73 | + |
| 74 | +6. Once your container is **ready**, click the **container endpoint** from its **Overview** tab. Your web page displays, and is available to anyone with the link. |
| 75 | + |
| 76 | +## Going further |
| 77 | + |
| 78 | +- You can host a website composed of multiple pages in the `my-static-website` folder. |
| 79 | +- You can [add a custom domain](/serverless-containers/how-to/add-a-custom-domain-to-a-container/) name to your website. |
| 80 | +- You can host dynamic websites using dedicated frameworks for high-quality web applications. |
0 commit comments