You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`mdBooks` lets you publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation.
17
+
[mdBook](https://rust-lang.github.io/mdBook/) lets you publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable, and customizable presentation.
19
18
20
-
This tutorial uses `mdbooks` to publish simple documentation but the main goal of this tutorial is to show how simple it is to
21
-
pick a project, package it inside an image and deploy it on Serverless Containers.
19
+
This tutorial uses `mdbook` to publish simple documentation but the main goal of this tutorial is to show how simple it is to pick a project, package it inside an image, and deploy it on Serverless Containers.
22
20
23
21
<Macroid="requirements" />
24
22
25
23
- A Scaleway account logged into the [console](https://console.scaleway.com)
26
24
-[Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
27
-
- Docker installed on your local machine
25
+
-[Docker](https://docs.docker.com/engine/install/) installed on your local machine
28
26
29
-
## Why deploy on Serverless?
27
+
## Why deploy on a Serverless infrastructure?
30
28
31
29
Serverless products are perfect for cost efficiency with a pay-as-you-go model, and scale very well.
32
30
33
-
With zero infrastructure management and many tools to integrate in CI/CD environments, an `mdbooks` deployment is well suited to Serverless Containers.
31
+
With zero infrastructure management and many tools to integrate in CI/CD environments, an `mdBook` deployment is well suited to Serverless Containers.
34
32
35
-
## Local setup
33
+
## Setting up mdBook locally
36
34
37
-
1. Follow the [installation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks.
35
+
1. Follow the [installation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdBook.
38
36
39
-
2. Run commands:
40
-
-`mdbook init my-first-book` in order to create a sample book.
41
-
-`cd my-first-book` to open the directory created by init command.
37
+
2. Run the following command to create a sample book:
38
+
```
39
+
mdbook init my-first-books
40
+
```
42
41
43
-
3.*(Optional)* Edit the content of the book to publish.
42
+
3. Run the following command to access the folder created by the previous `init` command:
43
+
```
44
+
cd my-first-book
45
+
```
44
46
45
-
4.Test the book using the command: `mdbook test`.
47
+
4.Optionally, you can edit the content of the book to publish.
46
48
47
-
## Prepare Container Registry
49
+
5. Test the book using the command below:
50
+
```
51
+
mdbook test
52
+
```
53
+
54
+
## Preparing the Container Registry
48
55
49
56
<Messagetype="note">
50
-
We recommend using Scaleway Container Registry instead of external registries to avoid errors of rate limiting and risks regarding evolutions of CGU and pricing.
57
+
We recommend using [Scaleway Container Registry](/containers/container-registry/) instead of external registries to avoid rate limiting errors, and risks linked to CGU and pricing changes.
51
58
</Message>
52
59
53
-
1. Create a file named `Dockerfile` in this folder containing the following code:
60
+
1. Create a file named `Dockerfile` in the previously created folder, and add the following code to it:
61
+
62
+
```dockerfile
63
+
FROM debian:bookworm-slim
64
+
65
+
WORKDIR /app
54
66
55
-
```dockerfile
56
-
FROM debian:bookworm-slim
67
+
# Copy the necessary files (add your custom files here)
68
+
COPY book.toml /app/
69
+
COPY src/* /app/src/
57
70
58
-
WORKDIR /app
71
+
# Install the mdbooks binary
72
+
RUN apt-get -y update; apt-get -y install curl;
73
+
RUN mkdir /home/mdbooks
74
+
RUN curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=/home/mdbooks
75
+
ENV PATH="$PATH:/home/mdbooks"
59
76
60
-
# Copy necessary files (add if you have custom files)
61
-
COPY book.toml /app/
62
-
COPY src/* /app/src/
77
+
# Serve the book
78
+
# 0.0.0.0 is required to listen on public interface, otherwise mdbook will only listen for localhost
79
+
# 8080 port is used to match the Serverless Container settings.
RUN curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=/home/mdbooks
68
-
ENV PATH="$PATH:/home/mdbooks"
83
+
2. Open the Scaleway console in a web browser, and navigate to the [Container Registry](https://console.scaleway.com/containers/).
69
84
70
-
# Serve the book:
71
-
# 0.0.0.0 is required to listen on public interface, otherwise mdbook will only listen for localhost
72
-
# 8080 port is used to match the Serverless Container settings.
3. Click **+ Create namespace**. [Namespaces](/containers/container-registry/concepts/#namespace) allow you to easily manage the images stored in your Container Registry.
75
86
76
-
2. Open a web browser on your computer and navigate to the [Container Registry](https://console.scaleway.com/containers/) product in the Scaleway console.
77
-
3. Click **Create namespace**. A namespace is used to hold the image.
87
+
4. Enter a name for your namespace, or keep the automatically generated one, then click **Create namespace**.
78
88
79
89
<Messagetype="note">
80
-
A pop-up will appear with information to log into your Container Registry Namespace with `docker login`. This will allow us to push the image later.
90
+
For more information on creating a Container Registry namespace, refer to [the dedicated documentation](/containers/container-registry/how-to/create-namespace/).
81
91
</Message>
82
92
83
-
4. Create the namespace and save the registry endpoint. The registry endpoint looks like `rg.<region>.scw.cloud/<namespace>`
93
+
## Building and pushing the image
84
94
85
95
<Messagetype="note">
86
-
Refer to [How to create a namespace](/docs/containers/container-registry/how-to/create-namespace/) for detailed information about Container Registry namespace creation.
96
+
Remember to replace the placeholders with the corresponding values in the steps below.
87
97
</Message>
88
-
## Build and push
89
98
90
-
1. Run the command `docker build -t rg.<region>.scw.cloud/<namespace>/<image_name>:<tag_name> .`
91
-
***region**: to get this information, check the namespace settings of the namespace you created.
92
-
***image_name**: use the name you want to identify your image, for example `mdbook`.
93
-
***tag_name**: use tags to identify the version of your image, for example `v1`.
99
+
1. Run the following command in a terminal to sign in to your Container Registry namespace:
0 commit comments