Skip to content

Commit 0349891

Browse files
maxirozayMachinisteWeb
authored andcommitted
Traduction de dockerize-vuejs-app (#161)
* translate dockerize-vuejs-app * @DeadalusDev's review * @rspt's review
1 parent d65fc34 commit 0349891

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed
+47-47
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,134 @@
11
---
2-
title: Dockerize Vue.js App (EN)
2+
title: Dockeriser une app Vue.js
33
type: cookbook
44
order: 13
55
---
66

7-
## Simple Example
7+
## Exemple
88

9-
<p>Cette page est en cours de traduction. Pour nous aider, vous pouvez participer sur <a href="https://github.com/vuejs-fr/vuejs.org" target="_blank">le dépôt GitHub dédié de Vuejs-FR</a>.</p><p>So you built your first Vue.js app using the amazing [Vue.js webpack template](https://github.com/vuejs-templates/webpack) and now you really want to show off with your colleagues by demonstrating that you can also run it in a Docker container.</p>
9+
Vous avez construit votre app Vue.js en utilisant le magnifique [Vue.js webpack template](https://github.com/vuejs-templates/webpack) et maintenant vous voulez vraiment impressionner vos collègues en montrant que vous pouvez aussi l'exécuter dans un container Docker.
1010

11-
Let's start by creating a `Dockerfile` in the root folder of our project:
11+
Commençons par créer un `Dockerfile` dans le dossier racine de notre projet.
1212

1313
```docker
1414
FROM node:9.11.1-alpine
1515
16-
# install simple http server for serving static content
16+
# installe un simple serveur http pour servir un contenu statique
1717
RUN npm install -g http-server
1818
19-
# make the 'app' folder the current working directory
19+
# définit le dossier 'app' comme dossier de travail
2020
WORKDIR /app
2121
22-
# copy both 'package.json' and 'package-lock.json' (if available)
22+
# copie 'package.json' et 'package-lock.json' (si disponible)
2323
COPY package*.json ./
2424
25-
# install project dependencies
25+
# installe les dépendances du projet
2626
RUN npm install
2727
28-
# copy project files and folders to the current working directory (i.e. 'app' folder)
28+
# copie les fichiers et dossiers du projet dans le dossier de travail (par exemple : le dossier 'app')
2929
COPY . .
3030
31-
# build app for production with minification
31+
# construit l'app pour la production en la minifiant
3232
RUN npm run build
3333
3434
EXPOSE 8080
3535
CMD [ "http-server", "dist" ]
3636
```
3737

38-
It may seem reduntant to first copy `package.json` and `package-lock.json` and then all project files and folders in two separate steps but there is actually [a very good reason for that](http://bitjudo.com/blog/2014/03/13/building-efficient-dockerfiles-node-dot-js/) (spoiler: it allows us to take advantage of cached Docker layers).
38+
Il peut sembler redondant de copier `package.json` et `package-lock.json` et ensuite tous les fichiers et dossiers du projet en deux étapes différentes mais il y a [une très bonne raison pour ça](http://bitjudo.com/blog/2014/03/13/building-efficient-dockerfiles-node-dot-js/) (résumé: ça nous permet de prendre avantage de la mise en cache des `Docker layers`)
3939

40-
Now let's build the Docker image of our Vue.js app:
40+
Maintenant on peut construire l'image Docker de notre app Vue.js :
4141

4242
```bash
4343
docker build -t vuejs-cookbook/dockerize-vuejs-app .
4444
```
4545

46-
Finally, let's run our Vue.js app in a Docker container:
46+
Finalement, lançons notre app Vue.js dans un container Docker :
4747

4848
```bash
4949
docker run -it -p 8080:8080 --rm --name dockerize-vuejs-app-1 vuejs-cookbook/dockerize-vuejs-app
5050
```
5151

52-
We should be able to access our Vue.js app on `localhost:8080`.
52+
On devrait pouvoir avoir accès à notre app sur `localhost:8080`.
5353

54-
## Real-World Example
54+
## Exemple réel
5555

56-
In the previous example, we used a simple, zero-configuration command-line [http server](https://github.com/indexzero/http-server) to serve our Vue.js app which is perfectly ok for quick prototyping and _may_ even be ok for simple production scenarios. After all, the documentation says:
56+
Dans l'exemple précédant, on a utilisé la ligne de commande [http-server](https://github.com/indexzero/http-server) sans configuration pour servir notre app Vue.js qui est parfaitement suffisent pour du prototypage rapide et pourrait même être suffire pour de simples scénarios de production. Après tout, la documentation dit :
5757

58-
> It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.
58+
> C'est assez puissant pour être utilisé en production, mais c'est assez simple et facile à détourner pour être utilisable pour les tests, le développement local et l’apprentissage.
5959
60-
Nevertheless, for realistically complex production use cases, it may be wiser to stand on the shoulders of some giant like [NGINX](https://www.nginx.com/) or [Apache](https://httpd.apache.org/) and that is exactly what we are going to do next: we are about to leverage NGINX to serve our Vue.js app because it is considered to be one of the most performant and battle-tested solutions out there.
60+
Néanmoins, pour un réel et complexe cas de production, il serait plus sage de se reposer sur les épaules de géants comme [NGINX](https://www.nginx.com/) ou [Apache](https://httpd.apache.org/) et c'est exactement ce que l'on va faire : on va utilisé NGINX pour servir notre app Vue.js parce qu'il est considéré comme une des solutions les plus performants et testées.
6161

62-
Let's refactor our `Dockerfile` to use NGINX:
62+
Modifions notre `Dockerfile` pour utiliser NGINX:
6363

6464
```docker
65-
# build stage
65+
# étape de build
6666
FROM node:9.11.1-alpine as build-stage
6767
WORKDIR /app
6868
COPY package*.json ./
6969
RUN npm install
7070
COPY . .
7171
RUN npm run build
7272
73-
# production stage
73+
# étape de production
7474
FROM nginx:1.13.12-alpine as production-stage
7575
COPY --from=build-stage /app/dist /usr/share/nginx/html
7676
EXPOSE 80
7777
CMD ["nginx", "-g", "daemon off;"]
7878
```
7979

80-
Ok, let's see what's going on here:
81-
* we have split our original `Dockerfile` in multiple stages by leveraging the Docker [multi-stage builds](https://docs.docker.com/develop/develop-images/multistage-build/) feature;
82-
* the first stage is responsible for building a production-ready artifact of our Vue.js app;
83-
* the second stage is responsible for serving such artifact using NGINX.
80+
Regardons ce qu'il se passe ici :
81+
* nous avons fragmenté notre `Dockerfile` original en plusieurs étapes en utilisant la fonction [multi-stage builds](https://docs.docker.com/develop/develop-images/multistage-build/) de Docker;
82+
* la première étape est responsable de la création d'un artéfact prêt pour la production de notre app Vue.js;
83+
* la deuxième étape est responsable du service de notre artéfact en utilisant NGINX.
8484

85-
Now let's build the Docker image of our Vue.js app:
85+
Maintenant, construisons l'image Docker de notre app Vue.js :
8686

8787
```bash
8888
docker build -t vuejs-cookbook/dockerize-vuejs-app .
8989
```
9090

91-
Finally, let's run our Vue.js app in a Docker container:
91+
Finalement, lançons notre app Vue.js dans un container Docker :
9292

9393
```bash
9494
docker run -it -p 8080:80 --rm --name dockerize-vuejs-app-1 vuejs-cookbook/dockerize-vuejs-app
9595
```
9696

97-
We should be able to access our Vue.js app on `localhost:8080`.
97+
On devrait avoir accès à notre app sur `localhost:8080`.
9898

99-
## Additional Context
99+
## Contexte additionnel
100100

101-
If you are reading this cookbook, chances are you already know why you decided to dockerize your Vue.js app. But if you simply landed on this page after hitting the Google's `I'm feeling lucky` button, let me share with you a couple of good reasons for doing that.
101+
Si vous lisez ce tutoriel, il y a des chances que vous savez déjà pourquoi vous avez décidé de dockeriser votre app Vue.js. Mais si vous avez simplement atterri sur cette page après avoir cliqué sur le bouton `j'ai de la chance` de Google, laissez-moi partager quelques bonnes raisons de le faire.
102102

103-
Today's modern trend is to build applications using the [Cloud-Native](https://pivotal.io/cloud-native) approach which revolves mainly around the following buzzwords:
103+
La tendance actuelle est de créer des applications en utilisant l'approche [Cloud-Native](https://pivotal.io/cloud-native) qui tourne autour des mots suivant :
104104
* Microservices
105-
* DevOps
105+
* DevOps (Développement opérationnel)
106106
* Continuous Delivery
107107

108-
Let's see how these concepts actually affect our decision of dockerizing our Vue.js app.
108+
Regardons comment ces concepts affectent notre décision de dockeriser notre app Vue.js.
109109

110-
### Effects of Microservices
110+
### Les effets des microservices
111111

112-
By adopting the [microservices architectural style](https://martinfowler.com/microservices/), we end up building a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms. These services are built around business capabilities and independently deployable by fully automated deployment machinery.
112+
En adoptant le [style d'architectural des microservices](https://martinfowler.com/microservices/), on finit par construire une seule application comme une suite de petits services, chaque service est lancé de manière indépendante et communique avec des mécanismes légers. Ces services sont construits autour des besoins du bizness et sont déployés indépendamment via des méthodes de déploiement automatisées.
113113

114-
So, committing to this architectural approach most of the time implies developing and delivering our front-end as an independent service.
114+
Alors, utiliser cette approche architecturale implique dans la plupart des cas de développer et livrer notre front-end comme un service indépendant.
115115

116-
### Effects of DevOps
116+
### Les effets du DevOps
117117

118-
The adoption of [DevOps](https://martinfowler.com/bliki/DevOpsCulture.html) culture, tools and agile engineering practices has, among other things, the nice effect of increasing the collaboration between the roles of development and operations. One of the main problem of the past (but also today in some realities) is that the dev team tended to be uninterested in the operation and maintenance of a system once it was handed over to the ops team, while the latter tended to be not really aware of the system's business goals and, therefore, reluctant in satisfying the operational needs of the system (also referred to as "whims of developers").
118+
L'adoption de la culture, des outils et des pratiques d’ingénierie agile [DevOps](https://martinfowler.com/bliki/DevOpsCulture.html) a, entre autres, le bon effet d'augmenter la collaboration entre les rôles de développement et des opérations. Un des principaux problèmes dans le passé (et encore aujourd'hui parfois) est que l'équipe de développement tend à être intéressée par les opérations et la maintenance du système une fois que ça a été donné à l'équipe d'intégration (DevOps), et cette dernière tend à ne pas être vraiment au courant du but du système, et donc est réticente à satisfaire les besoins opérationnels du système (aussi appelé "les caprices des développeurs").
119119

120-
So, delivering our Vue.js app as a Docker image helps reducing, if not removing entirely, the difference between running the service on a developer's laptop, the production environment or any environment we may think of.
120+
Livrer notre app Vue.js avec une image Docker aide à réduire, sinon supprimer totalement, les différences entre lancer le service sur l'ordinateur d'un développeur, un environnement de production ou n'importe quel autre environnement.
121121

122-
### Effects of Continuous Delivery
122+
### Les effets du déploiement continu (Continuous Delivery)
123123

124-
By leveraging the [Continuous Delivery](https://martinfowler.com/bliki/ContinuousDelivery.html) discipline we build our software in a way that it can potentially be released to production at any time. Such engineering practice is enabled by means of what is normally called [continuous delivery pipeline](https://martinfowler.com/bliki/DeploymentPipeline.html). The purpose of a continuous delivery pipeline is to split our build into stages (e.g. compilation, unit tests, integration tests, performance tests, etc.) and let each stage verify our build artifact whenever our software changes. Ultimately, each stage increases our confidence in the production readiness of our build artifact and, therefore, reduces the risk of breaking things in production (or any other environment for that matters).
124+
En utilisant le [déploiement continu](https://martinfowler.com/bliki/ContinuousDelivery.html) on construit nos logiciels de manière à ce qu'ils puissent potentiellement être déployés en production n'importe quand. Ces pratiques d'ingénierie sont permises grâce à ce qui est normalement appelé le [pipeline de déploiement continu](https://martinfowler.com/bliki/DeploymentPipeline.html). Le but d'un pipeline de déploiement continu est de fragmenter notre build en plusieurs étapes (par exemple : la compilation, les tests unitaires, les tests d’intégration, les tests de performance, etc.) et laisser chaque étape vérifier notre artéfact de build quand notre logiciel change. Chaque étape augmente notre confiance dans la stabilité du build de notre artéfact, et donc, réduit le risque de casser quelque chose en production (ou n'importe quel autre environnement).
125125

126-
So, creating a Docker image for our Vue.js app is a good choice here because that would represent our final build artifact, the same artifact that would be verified against our continuous delivery pipeline and that could potentially be released to production with confidence.
126+
Alors, créer une image Docker pour notre app Vue.js est une bonne chose car ça représente notre artéfact de build final, le même artéfact qui va être utilisé localement pour le développement et qui peut être utilisé pour le déploiement en production avec confiance.
127127

128-
## Alternative Patterns
128+
## Modèles alternatifs
129129

130-
If your company is not into Docker and Kubernetes just yet or you simply want to get your MVP out the door, maybe dockerizing your Vue.js app is not what you need.
130+
Si votre entreprise n'est pas encore intéressée par Docker et Kubernetes ou que vous voulez simplement déployer votre MVP, peut être que dockeriser votre app Vue.js n'est pas ce qu'il vous faut.
131131

132-
Common alternatives are:
133-
* leveraging an all-in-one platform like [Netlify](https://www.netlify.com/);
134-
* hosting your SPA on [Amazon S3](https://aws.amazon.com/s3/) and serving it with [Amazon CloudFront](https://aws.amazon.com/cloudfront/) (see [this](https://serverless-stack.com/chapters/deploy-the-frontend.html) link for a detailed guide).
132+
Il existe d'autres alternatives comme :
133+
* utiliser une plateforme tout-en-un comme [Netlify](https://www.netlify.com/);
134+
* héberger votre SPA sur [Amazon S3](https://aws.amazon.com/s3/) et la servir avec [Amazon CloudFront](https://aws.amazon.com/cloudfront/) (voir [ici](https://serverless-stack.com/chapters/deploy-the-frontend.html) pour un guide détaillé).

0 commit comments

Comments
 (0)