Skip to content

Commit a678906

Browse files
EN proof
1 parent a9d6669 commit a678906

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

pages/platform/ai/deploy_tuto_12_build_custom_image/guide.en-gb.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: AI Deploy - Tutorial - Build & use custom Docker image
2+
title: AI Deploy - Tutorial - Build & use a custom Docker image
33
slug: deploy/build-use-custom-image
44
excerpt: Explanations on how to build and use your own custom image
55
section: AI Deploy - Tutorials
@@ -11,15 +11,15 @@ updated: 2023-03-29
1111

1212
## Objective
1313

14-
This tutorial covers the process of building your own Docker image for AI deploy. After detailing major guidelines, we will cover a quick example.
14+
This tutorial covers the process of building your own Docker image for AI Deploy. After detailing major guidelines, we will cover a quick example.
1515

1616
## Requirements
1717

1818
- Access to the [OVHcloud Control Panel](https://www.ovh.com/auth/?action=gotomanager&from=https://www.ovh.co.uk/&ovhSubsidiary=GB)
1919
- A **Public Cloud** project
2020
- A [user for AI Deploy](https://docs.ovh.com/gb/en/publiccloud/ai/users)
21-
- [Docker](https://www.docker.com/get-started) installed somewhere like your personal computer or a virtual machine
22-
- Some knowledge about building an image. Follow [official Docker Getting Started](https://docs.docker.com/get-started/)
21+
- [Docker](https://www.docker.com/get-started) installed on a personal computer or a virtual machine
22+
- Knowledge about building a Docker image (see the [official Getting Started guide](https://docs.docker.com/get-started/))
2323

2424
## Quick overview
2525

@@ -50,28 +50,28 @@ If you need to work with GPU, please read the next paragraph.
5050

5151
> [!primary]
5252
>
53-
> If you want to communicate with our **GPU** hardware in your **AI Deploy apps**, the base image should have **cuda drivers installed on**.
53+
> If you want to communicate with our **GPU** hardware in your **AI Deploy apps**, the base image should have **cuda drivers installed**.
5454
5555
Here is a potential list of official base images (featuring **cuda drivers**) that you can use:
5656

5757
- [pytorch/pytorch:latest](https://hub.docker.com/r/pytorch/pytorch)
5858
- [tensorflow/tensorflow:latest-gpu](https://hub.docker.com/r/tensorflow/tensorflow)
59-
- [huggingface/transformers-pytorch-gpu:latest](https://hub.docker.com/r/huggingface/transformers-pytorch-gpu/) docker pull huggingface/transformers-pytorch-gpu:latest
59+
- [huggingface/transformers-pytorch-gpu:latest](https://hub.docker.com/r/huggingface/transformers-pytorch-gpu/) (docker pull huggingface/transformers-pytorch-gpu:latest)
6060
- [mxnet/python](https://hub.docker.com/r/mxnet/python)
6161
- [nvidia/cuda](https://hub.docker.com/r/nvidia/cuda)
6262

63-
For example if you want to start from the base image `tensorflow/tensorflow:latest-gpu`:
63+
For example, if you want to start from the base image `tensorflow/tensorflow:latest-gpu`:
6464

6565
```{.console}
6666
FROM tensorflow/tensorflow:latest-gpu
6767
```
6868

6969
### Use the linux/amd64 architecture
7070

71-
Your Docker image has to support at least `linux/amd64` platform to be deployed correctly. Otherwise deployment will fail.
71+
Your Docker image has to support at least the `linux/amd64` platform to be deployed correctly. Otherwise deployment will fail.
7272

7373
When you invoke a build, you can set the `--platform` flag to specify the target platform for the build output, `linux/amd64`.
74-
This is especially relevant if you use Apple new computers (M1/M2/... chipsets) or ARM-based computers.
74+
This is especially relevant if you use newer Apple computers (M1/M2/... chipsets) or ARM-based computers.
7575

7676
```{.console}
7777
docker buildx build --platform linux/amd64,linux/arm64 ...
@@ -81,12 +81,12 @@ More information can be found in the [official Docker documentation](https://doc
8181

8282
### Create an OVHcloud user and a working directory
8383

84-
Deployed containers are not run as root user, but by an “OVHcloud” user with **UID 42420**.
84+
Deployed containers are not run as root, but by an “OVHcloud” user with **UID 42420**.
8585
It means that if you want to be able to write in a specific directory at runtime, you will have to give it specific rights.
8686

87-
This is the case in the vast majority of use-cases.
87+
This is the case in the vast majority of use cases.
8888

89-
You can do it with the following instruction:
89+
You can do it with the following instructions:
9090

9191

9292
```{.console}
@@ -128,24 +128,24 @@ RUN pip install -r requirements.txt
128128
### Manage output data effectively (S3, ...)
129129

130130
Just like AI Notebooks and AI Training, AI Deploy is easily connected to remote storage such as S3 object storage containers at launch.
131-
However, unlike AI Notebooks and AI Training, AI Deploy **does NOT** synchronize data back to your remote storage.
131+
However, unlike AI Notebooks and AI Training, AI Deploy **does NOT** synchronise data back to your remote storage.
132132

133133
If you need to write data somewhere, for example output from your AI model (generated images), your code application should include storage connection.
134-
For example, you can use Python `Boto3` library when using Python and S3.
134+
For example, you can use the Python `Boto3` library when using Python and S3.
135135

136136
Be careful, **if you write data directly in your working directory, it will be lost when you stop your application**.
137137

138138
### Use environment variables for dynamic values
139139

140140
> [!primary]
141141
>
142-
> For sensitive data such as password or token, consider using [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/).
142+
> For sensitive data such as passwords or tokens, consider using [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/).
143143
144-
Sometimes, instead of hardcoding a variable inside a Dockerfile, it is much more powerful to pass variables during deployment. Docker provides natively this option with `--env` argument, and OVHcloud AI tools follow the same logic.
144+
Sometimes, instead of hardcoding a variable inside a Dockerfile, it is much more powerful to pass variables during deployment. Docker provides this option natively through the `--env` argument, and OVHcloud AI tools follow the same logic.
145145

146-
During AI Deploy app creation, you will be able to pass environment variables via CLI, API or UI in the control panel. In your Dockerfile, you can gather theses variables with the `ENV` value
146+
During AI Deploy app creation, you will be able to pass environment variables via CLI, API or UI in the control panel. In your Dockerfile, you can gather theses variables with the `ENV` value.
147147

148-
For example, you can launch a new app with two variable like this:
148+
For example, you can launch a new app with two variables like this:
149149

150150
```
151151
ovhai run app <my_docker_image> -e LANGUAGE=english TOKEN=12345678
@@ -172,34 +172,34 @@ ADD . $foo
172172
### Exposing your model or application with an API
173173

174174
Inside your Dockerfile, you will need to expose your model or application so anyone can use it. The easiest way is to expose API via REST endpoint.
175+
The most popular open source frameworks for exposing APIs are [Flask]() and [Fast API]().
175176

176-
Most famous and open source frameworks for exposing API are [Flask]() and [Fast API]()
177-
You can find a basic example in the next chapter, and more advanced tutorials in [AI Deploy documentation](https://docs.ovh.com/gb/en/publiccloud/ai/).
177+
You can find a basic example in the section below, and more advanced tutorials in our [AI Deploy documentation](https://docs.ovh.com/gb/en/publiccloud/ai/).
178178

179179
### Exposing your application with a web frontend
180180

181181
While an API is useful for automation and code, sometimes you will need to expose your application or model through a web interface.
182182

183-
AI Deploy is fully compliant with multiple frontend frameworks, such as [Streamlit](https://streamlit.io/), [Gradio](https://gradio.app/) or [Taipy](https://www.taipy.io/
184-
).
183+
AI Deploy is fully compliant with multiple frontend frameworks, such as [Streamlit](https://streamlit.io/), [Gradio](https://gradio.app/) or [Taipy](https://www.taipy.io/).
185184
You can of course also build your own frontend with your favourite tools, such as HTML/CSS.
186-
You can find a basic example in the next chapter, and more advanced tutorials in [AI Deploy documentation](https://docs.ovh.com/gb/en/publiccloud/ai/).
187185

188-
## Basic example: write your own Dockerfile and build your image
186+
You can find a basic example in the section below, and more advanced tutorials in our [AI Deploy documentation](https://docs.ovh.com/gb/en/publiccloud/ai/).
189187

190-
Here, we will build a basic docker image, following the guidelines.
188+
## Basic example: Write your own Dockerfile and build your image
189+
190+
Here we will build a basic Docker image, following the guidelines.
191191

192192
### Prepare the Dockerfile
193193

194-
Create a new file and name it `Dockerfile` following guidelines.
194+
Create a new file and name it `Dockerfile`, following the guidelines.
195195

196196
1. First you need to choose a base image to start from.
197-
2. Install what you need as dependencies with `apt` or `pip`. Bash command instructions on your Dockerfile should begin with `RUN` prefix.
198-
3. Copy files from your local directory inside docker image with the `COPY` prefix.
199-
4. Allow user OVHcloud UID 42420 to get specific rights
200-
5. Run your script
197+
2. Install what you need as dependencies with `apt` or `pip`. Bash command instructions on your Dockerfile should begin with the `RUN` prefix.
198+
3. Copy files from your local directory inside the Docker image with the `COPY` prefix.
199+
4. Allow user "OVHcloud UID 42420" to get specific rights.
200+
5. Run your script.
201201

202-
A basic example can be summarized like this:
202+
A basic example can be summarised like this:
203203

204204
```{.console}
205205
# Start from official Python image since we don't need GPU
@@ -215,7 +215,7 @@ RUN apt-get update && apt-get install -y vim git
215215
ADD example.py /workspace/
216216
ADD dataset.csv /workspace/
217217
218-
# Create a HOME dedicated to the OVHcloud user (42420:42420). mandatory step
218+
# Create a HOME dedicated to the OVHcloud user (42420:42420). Mandatory step
219219
RUN chown -R 42420:42420 /workspace
220220
ENV HOME=/workspace
221221
@@ -225,28 +225,28 @@ CMD [ "python3" , "/workspace/example.py" ]
225225

226226
### Build your Docker image
227227

228-
Once your **Dockerfile** is complete and match your needs, you have to choose a name and build the image using the following command in the same directory:
228+
Once your **Dockerfile** is complete and matches your needs, you have to choose a name and build the image using the following command in the same directory:
229229

230230
```{.console}
231231
docker build . -t <image-identifier>
232232
```
233233

234234
> [!primary]
235235
>
236-
> The dot `.` argument indicates that your build context (place of the **Dockerfile** and other needed files) is the current directory.
236+
> The dot argument `.` indicates that your build context (place of the **Dockerfile** and other needed files) is the current directory.
237237
238238
> [!primary]
239239
>
240240
> The `-t` argument allows you to choose the identifier to give to your image. Usually, image identifiers are composed of a **name** and a **version tag** `<name>:<version>`.
241241
242242
> [!warning]
243243
>
244-
> Please make sure that the docker image you will push in order to run containers using AI products respects the **linux/amd64** architecture. You could, for instance, build your image using **buildx** as follows:
244+
> Please make sure that the Docker image you will push in order to run containers using AI products respects the **linux/amd64** architecture. You could, for instance, build your image using **buildx** as follows:
245245
>
246246
> `docker buildx build --platform linux/amd64 ...`
247247
>
248248
249-
## Test it locally (Optional)
249+
## Test it locally (optional)
250250

251251
If you want to verify that your built image is working properly, run the following command:
252252

@@ -256,17 +256,17 @@ docker run --rm -it --user=42420:42420 <image-identifier>
256256

257257
> [!warning]
258258
>
259-
> Don't forget the `--user=42420:42420` argument if you want to simulate the exact same behavior that will occur on **AI Deploy apps **. It executes the docker container as the specific OVHcloud user (user **42420:42420**).
259+
> Don't forget the `--user=42420:42420` argument if you want to simulate the exact same behaviour that will occur on **AI Deploy apps**. It executes the Docker container as the specific OVHcloud user (user **42420:42420**).
260260
261-
### Push image in the registry of your choice
261+
### Push the image to the registry of your choice
262262

263263
Pushing your image to a registry is needed in order for AI Deploy to pull it.
264264

265265
AI Deploy provides a default registry called **Shared registry** where users are able to push their custom images. It is linked with every project by default.
266266

267-
If you prefer using your own private docker registry instead of the shared one, feel free to use it. Just don't forget to [add your registry in your AI Tools project](https://docs.ovh.com/gb/en/publiccloud/ai/training/add-private-registry) before using it.
267+
If you prefer using your own private Docker registry instead of the shared one, feel free to use it. Just don't forget to [add your registry in your AI Tools project](https://docs.ovh.com/gb/en/publiccloud/ai/training/add-private-registry) before using it.
268268

269-
The basic commands to push a docker image to a registry is:
269+
The basic commands to push a Docker image to a registry is:
270270

271271
```{.console}
272272
# Add a new registry into OVHcloud AI Tools
@@ -278,7 +278,7 @@ docker tag <image-identifier> <registry>/<image-identifier>
278278
docker push <registry>/<image-identifier>
279279
```
280280

281-
Example: if you want to push an image named `custom-image` inside a registry `registry.gra.training.ai.cloud.ovh.net` :
281+
Example: If you want to push an image named `custom-image` inside a registry `registry.gra.training.ai.cloud.ovh.net`:
282282

283283
```{.console}
284284
# Add a new registry into OVHcloud AI Tools
@@ -302,4 +302,4 @@ If you want to know the exact commands to push on the shared registry, please co
302302

303303
Please send us your questions, feedback and suggestions to improve the service:
304304

305-
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)
305+
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)

0 commit comments

Comments
 (0)