|
1 |
| -# Deploying to Minikube |
| 1 | +# Deploying to minikube |
2 | 2 |
|
3 |
| -## Install Minikube |
| 3 | +## Install minikube |
4 | 4 |
|
5 |
| -If you have no existing installation of Minikube on your computer, [follow the official tutorial](https://minikube.sigs.k8s.io/docs/start/). |
| 5 | +If you have no existing installation of minikube on your computer, [follow the official tutorial](https://minikube.sigs.k8s.io/docs/start/). |
6 | 6 |
|
7 | 7 | When Minikube is installed, start the cluster:
|
8 | 8 |
|
9 | 9 | ```console
|
10 | 10 | minikube start --addons registry --addons dashboard
|
11 | 11 | ```
|
12 | 12 |
|
13 |
| -The previous command starts Minikube with a Docker registry (we'll use it in the next step) and with the Kubernetes dashboard. |
14 |
| - |
15 |
| -If you use Mac or Windows, [refer to the documentation](https://minikube.sigs.k8s.io/docs/handbook/registry/#docker-on-macos) to learn how to expose the Docker registry installed as an addon on the port 5000 of the host. |
| 13 | +The previous command starts minikube with a Docker registry (we'll use it in the next step) and with the Kubernetes dashboard. |
16 | 14 |
|
17 | 15 | Finally, [install Helm](https://helm.sh/docs/intro/install/). We'll use it to deploy the application in the cluster thanks to the chart provided in the API Platform distribution.
|
18 | 16 |
|
19 | 17 | ## Building and Pushing Docker Images
|
20 | 18 |
|
21 |
| -First, build the images: |
| 19 | +On GNU/Linux and macOS, run the following command following command to point your terminal’s docker-cli to the Docker Engine inside minikube: |
| 20 | + |
| 21 | +```console |
| 22 | +eval $(minikube docker-env) |
| 23 | +``` |
| 24 | + |
| 25 | +Now any `docker` command you run in this current terminal will run against the Docker Engine inside the minikube cluster. For detailed explanation and instructions for Windows [visit official minikube documentation](https://minikube.sigs.k8s.io/docs/handbook/pushing/#1-pushing-directly-to-the-in-cluster-docker-daemon-docker-env). |
| 26 | + |
| 27 | +Build the images in minikube: |
22 | 28 |
|
23 | 29 | ```console
|
24 |
| -docker build -t localhost:5000/php api --target api_platform_php |
25 |
| -docker build -t localhost:5000/caddy api --target api_platform_caddy |
26 |
| -docker build -t localhost:5000/pwa pwa --target api_platform_pwa_prod |
| 30 | +docker build -t localhost:5000/php api --target frankenphp_prod |
| 31 | +docker build -t localhost:5000/pwa pwa --target prod |
27 | 32 | ```
|
28 | 33 |
|
29 |
| -Then push the images in the registry installed in Minikube: |
| 34 | +Then push the images in the registry available in minikube: |
30 | 35 |
|
31 | 36 | ```console
|
32 | 37 | docker push localhost:5000/php
|
33 |
| -docker push localhost:5000/caddy |
34 | 38 | docker push localhost:5000/pwa
|
35 | 39 | ```
|
36 | 40 |
|
37 | 41 | ## Deploying
|
38 | 42 |
|
| 43 | +Fetch Helm chart dependencies: |
| 44 | + |
| 45 | +```console |
| 46 | +helm repo add postgresql https://charts.bitnami.com/bitnami/ |
| 47 | +helm dependency build helm/api-platform |
| 48 | +``` |
| 49 | + |
39 | 50 | Finally, deploy the project using the Helm chart:
|
40 | 51 |
|
41 | 52 | ```console
|
42 |
| -$ helm install my-project helm/api-platform \ |
| 53 | +helm install my-project helm/api-platform \ |
43 | 54 | --set php.image.repository=localhost:5000/php \
|
44 | 55 | --set php.image.tag=latest \
|
45 |
| - --set caddy.image.repository=localhost:5000/caddy \ |
46 |
| - --set caddy.image.tag=latest \ |
47 | 56 | --set pwa.image.repository=localhost:5000/pwa \
|
48 | 57 | --set pwa.image.tag=latest
|
49 | 58 | ```
|
|
0 commit comments