Skip to content

Commit 4694261

Browse files
authored
Merge pull request #188 from dummyeuy/dockerize-vuejs-app
Translate src/v2/cookbook/**dockerize-vuejs-app.md** by dummyeuy
2 parents 9a80b6d + 58ca41a commit 4694261

File tree

1 file changed

+50
-49
lines changed

1 file changed

+50
-49
lines changed
+50-49
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,135 @@
11
---
2-
title: Dockerize Vue.js App
2+
title: Dockerize Aplikasi Vue.js App
33
type: cookbook
44
order: 13
55
---
6+
<!-- docs/hooks-faq.md ini diterjemahkan oleh dummyeuy (Muhammad Ghalib) -->
67

7-
## Simple Example
8+
## Contoh Sederhana
89

9-
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.
10+
Jadi, Anda membangun aplikasi Vue.js pertama Anda menggunakan [templat *webpack* Vue.js](https://github.com/vuejs-templates/webpack) yang menakjubkan dan kini sangat ingin menunjukkannya pada teman-teman Anda dengan sebuah mendemonstrasi yang mana bisa Anda jalankan juga pada sebuah wadah *Docker*.
1011

11-
Let's start by creating a `Dockerfile` in the root folder of our project:
12+
Mari mulai dengan membuat sebuah`Dockerfile` di folder dasar proyek kita:
1213

1314
```docker
1415
FROM node:lts-alpine
1516
16-
# install simple http server for serving static content
17+
# pasang (install) server http sederhana untuk menjalankan static content
1718
RUN npm install -g http-server
1819
19-
# make the 'app' folder the current working directory
20+
# buat folder 'app' pada direktori yang sedang dikerjakan
2021
WORKDIR /app
2122
22-
# copy both 'package.json' and 'package-lock.json' (if available)
23+
# salin 'package.json' dan 'package-lock.json' (jika ada)
2324
COPY package*.json ./
2425
25-
# install project dependencies
26+
# pasang dependecy proyek
2627
RUN npm install
2728
28-
# copy project files and folders to the current working directory (i.e. 'app' folder)
29+
# salin berkas-berkas proyek serta folder-foldernya ke direktori yang sedang dikerjakan (misal. folder 'app)
2930
COPY . .
3031
31-
# build app for production with minification
32+
# bangun aplikasi untuk produksi dengan minifikasi
3233
RUN npm run build
3334
3435
EXPOSE 8080
3536
CMD [ "http-server", "dist" ]
3637
```
3738

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).
39+
Awalnya mungkin terlihat berlebihan untuk menyalin `package.json` dan `package-lock.json` serta seluruh berkas proyek dalam dua langkah terpisah, tetapi sebenarnya ada sebuah[alasan baik di baliknya](http://bitjudo.com/blog/2014/03/13/building-efficient-dockerfiles-node-dot-js/) (*spoiler*: hal tersebut mengizinkan kita untuk memanfaatkan lapisan-lapisan Docker dengan *cache*).
3940

40-
Now let's build the Docker image of our Vue.js app:
41+
Sekarang ayo buat tampilan *Docker* untuk aplikasi Vue.js kita:
4142

4243
```bash
4344
docker build -t vuejs-cookbook/dockerize-vuejs-app .
4445
```
4546

46-
Finally, let's run our Vue.js app in a Docker container:
47+
Akhirnya, saatnya jalankan aplikasi Vue.js kita di sebuah wadah *Docker*:
4748

4849
```bash
4950
docker run -it -p 8080:8080 --rm --name dockerize-vuejs-app-1 vuejs-cookbook/dockerize-vuejs-app
5051
```
5152

52-
We should be able to access our Vue.js app on `localhost:8080`.
53+
Kita seharusnya dapat mengakses aplikasi Vue.js kita di `localhost:8080`.
5354

54-
## Real-World Example
55+
## Contoh Dunia Nyata
5556

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:
57+
Pada contoh sebelumnya, kita menggunakan sebuah *command-line* [http server](https://github.com/indexzero/http-server) yang sederhana dan tanpa konfigurasi tertentu untuk menjalankan aplikasi Vue.js kita - yang mana sangat cocok untuk *prototyping* cepat dan _bisa jadi_ baik untuk skenario produksi-produksi sederhana. Lagipula, dokumentasinya mengatakan demikian:
5758

58-
> It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.
59+
> Hal tersebut cukup baik untuk penggunaan dalam hal produksi, tapi juga cukup sederhana dan mudah diretas untuk pengujian, pengembangan lokal, serta pembelajaran.
5960
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.
61+
Meskipun demikian, untuk kasus-kasus produksi yang kompleks secara nyata, akan lebih bijak untuk mengandalkan beberapa nama besar seperti [*NGINX*](https://www.nginx.com/) atau [*Apache*](https://httpd.apache.org/) dan itulah hal yang akan kita lakukan selanjutnya: kita akan we are about memanfaatkan *NGINX* untuk menjalankan aplikasi Vue.js kita karena hal tersebut dipertimbangkan sebagai salah satu solusi dan pihak yang telah teruji dengan sangat baik.
6162

62-
Let's refactor our `Dockerfile` to use NGINX:
63+
Mari me-*refactor* `Dockerfile` kita untuk menggunakan *NGINX*:
6364

6465
```docker
65-
# build stage
66+
# tahap pengembangan
6667
FROM node:lts-alpine as build-stage
6768
WORKDIR /app
6869
COPY package*.json ./
6970
RUN npm install
7071
COPY . .
7172
RUN npm run build
7273
73-
# production stage
74+
# tahap produksi
7475
FROM nginx:stable-alpine as production-stage
7576
COPY --from=build-stage /app/dist /usr/share/nginx/html
7677
EXPOSE 80
7778
CMD ["nginx", "-g", "daemon off;"]
7879
```
7980

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.
81+
Baik, mari kita lihat apa yang terjadi kini:
82+
* kita sudah memisahkan `Dockerfile` asli milik kita ke dalam beberapa tahapan dengan memanfaatkan fitur [pengembangan *multi-stage*](https://docs.docker.com/develop/develop-images/multistage-build/) Docker;
83+
* tahap pertama bertujuan untuk mengembangkan sebuah *artefak* yang siap prduksi dari aplikasi Vue.js kita;
84+
* tahap kedua bertujuan untuk menjalankan *artefak* tersebut mengguankan *NGINX*.
8485

85-
Now let's build the Docker image of our Vue.js app:
86+
Kini ayo bangun tampilan *Docker* dari aplikasi Vue.js kita:
8687

8788
```bash
8889
docker build -t vuejs-cookbook/dockerize-vuejs-app .
8990
```
9091

91-
Finally, let's run our Vue.js app in a Docker container:
92+
Pada akhirnya, jalankan aplikasi Vue.js kita dalam wadah *Docker*:
9293

9394
```bash
9495
docker run -it -p 8080:80 --rm --name dockerize-vuejs-app-1 vuejs-cookbook/dockerize-vuejs-app
9596
```
9697

97-
We should be able to access our Vue.js app on `localhost:8080`.
98+
Kita seharusnya bisa mengakses aplikasi Vue.js kita di `localhost:8080`.
9899

99-
## Additional Context
100+
## Konteks Tambahan
100101

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.
102+
Jika Anda membaca *cookbook* ini, ada kemungkinan Anda sudah tahu alasan mengapa Anda memilih untuk men-*dockerize* aplikasi Vue.js Anda. Tetapi jika Anda hanya tiba di laman ini tanpa alasan spesifik seperti di atas, izinkan kami bagikan pada Anda beberapa alasan baik mengapa membaca *cookbook* ini bermanfaat.
102103

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:
104-
* Microservices
105-
* DevOps
106-
* Continuous Delivery
104+
Tren modern kini adalah membangun aplikasi menggunakan pendekatan [*Cloud-Native*](https://pivotal.io/cloud-native) yang mana merevolusi terutama pada hal-hal berikut:
105+
* *Microservice*
106+
* *DevOps* (*Development and Operations*/ Pengembangan dan Operasi)
107+
* *Delivery* secara kontinyu
107108

108-
Let's see how these concepts actually affect our decision of dockerizing our Vue.js app.
109+
Mari lihat bagaimana konsep-konsep ini sebenarnya mempengaruhi keputusan kita dalam hal proses *dockerize* aplikasi Vue.js kita.
109110

110-
### Effects of Microservices
111+
### Efek *Microservice*
111112

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.
113+
Dengan mengadopsi [gaya arsitektural *microservice*](https://martinfowler.com/microservices/), kita berakhir pada membangun sebuah aplikasi tunggal sebagai sebuah rangkaian layanan-layanan (*service*) kecil, tiap layanannya berjalan pada prosesnya sendiri dan berkomunikasi dengan mekanisme yang ringan. Layanan ini dibangun di sekitar kapabilitas bisnis dan secara independen dapat diluncurkan oleh mesin peluncuran (*deployment*) yang sepenuhnya otomatis.
113114

114-
So, committing to this architectural approach most of the time implies developing and delivering our front-end as an independent service.
115+
Jadi, memutuskan untuk menerapkan pendekatan arsitektural ini sering kali berdampak pada pengembangan dan peluncuran *front-end* kita sebagai sebuah layanan yang independen.
115116

116-
### Effects of DevOps
117+
### Efek *DevOps*
117118

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").
119+
Mengadopsi kultur [*DevOps*](https://martinfowler.com/bliki/DevOpsCulture.html), perlengkapan serta praktik-praktik teknis yang tangkas (*agile*), di antara hal lain, telah memiliki dampak baik pada meningkatnya kolaborasi antara peran-peran dalam pengembangan dan operasi (*development and operations*). Masalah utama di masa lalu (tapi juga hingga hari ini pada beberapa kasus) adalah tim pengembang cenderung tidak tertarik dalam hal operasi dan pemeliharaan (*maintenance*) sistem selepas produk sudah dipindahtangankan pada tim operasi, ketika tim yang terakhir cenderung tidak begitu sadar akan tujuan bisnis sistem ini serta, oleh karenanya, dengan berat hati berusaha memuaskan kebutuhan operasional sistem (juga disebut-sebut sebagai "ke-pengecut-an pengembang").
119120

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.
121+
Jadi, menyerahkan aplikasi Vue.js sebagai sebuah tampilan Docker membantu mengurangi -jika tidak menghilangkan seluruhnya- perbedaan antara menjalankan layanan di laptop pengembang, lingkungan pengembangan atau lingkungan apapun yang kita pikirkan.
121122

122-
### Effects of Continuous Delivery
123+
### Efek *Delivery* secara Kontinyu
123124

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).
125+
Dengan memanfaatkan [*delivery* secara kontinyu](https://martinfowler.com/bliki/ContinuousDelivery.html) secara teratur kita membangun perangkat lunak dengan cara yng mana bisa dirilis kapan pun secara potensial. Praktik teknis demikian diperbolehkan agar [*delivery pipeline* berjalan secara kontinyu](https://martinfowler.com/bliki/DeploymentPipeline.html). Tujuan *delivery pipeline* secara kontinyu ini untuk membagi pengembangan menjadi beberapa tahap (misal, kompilasi, uji unit, uji integrasi, uji performa, dsb.) dan memperbolehkan tiap tahap memverifikasi artefak pengembangan kita kapanpun perangkat lunak kita berubah. Pada akhirnya, tiap tahap meningkatkan kepercayaan diri kita dalam hal kesiapan produksi pada artifak yang kita kembangkan, oleh karenanya, mengurangi resiko rusaknya beberapa hal dalam tahapan produksi (atau lingkungan lain yang penting).
125126

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.
127+
Jadi, membuat tampilan *Docker* aplikasi Vue.js adalah pilihan yang baik di sini karena hal tersebut akan merepresentasikan hasil akhir pengembangan artefak kita, barang yang sama yang akan diverifikasi dengan *delivery pipeline* kotinyu kita serta secara potensial dapat dirilis ke tahap produksi dengan yakin.
127128

128-
## Alternative Patterns
129+
## Pola-pola Alternatif
129130

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.
131+
Jika perusahaan Anda sekarang belum mengadopsi *Docker* dan/atau *Kubernetes* atau Anda hanya ingin meningkatkan kapabilitas diri Anda jadi yang terbaik, mungkin saja me-*dockerize* aplikasi Vue.js bukanlah hal yang Anda butuhkan.
131132

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).
133+
Alternatif-alternatif umum lainnya:
134+
* memanfaatkan sebuah *platform* yang *all-in-one* seperti [*Netlify*](https://www.netlify.com/);
135+
* men-*hosting* *SPA* Anda di [*Amazon S3*](https://aws.amazon.com/s3/) dan menjalankannya dengan [*Amazon CloudFront*](https://aws.amazon.com/cloudfront/) (lihat [tautan ini](https://serverless-stack.com/chapters/deploy-the-frontend.html) untuk penduan lebih rinci).

0 commit comments

Comments
 (0)