Deploying to Minikube

Install Minikube

If you haven't an existing installation of Minikube on your computer, follow the official tutorial.

コンピューターに Minikube が既にインストールされていない場合は、公式のチュートリアルに従ってください。

When Minkube is installed, start the cluster:

Minkube がインストールされたら、クラスターを起動します。

minikube start --addons registry --addons dashboard

The previous command starts Minikube with a Docker registry (we'll use it in the next step) and with the Kubernetes dashboard.

前のコマンドは、Docker レジストリー (次のステップで使用します) と Kubernetes ダッシュボードを使用して Minikube を開始します。

If you use Mac or Windows, refer to the documentation to learn how to expose the Docker registry installed as an addon on the port 5000 of the host.

Mac または Windows を使用している場合は、ドキュメントを参照して、ホストのポート 5000 にアドオンとしてインストールされた Docker レジストリを公開する方法を確認してください。

Finally, install Helm. We'll use it to deploy the application in the cluster thanks to the chart provided in the API Platform distribution.

最後に Helm をインストールします。 API プラットフォーム ディストリビューションで提供されているチャートのおかげで、これを使用してクラスターにアプリケーションをデプロイします。

Building and Pushing Docker Images

First, build the images:

まず、イメージをビルドします。

docker build -t localhost:5000/php api --target api_platform_php
docker build -t localhost:5000/caddy api --target api_platform_caddy
docker build -t localhost:5000/pwa pwa --target api_platform_pwa_prod

Then push the images in the registry installed in Minikube:

次に、Minikube にインストールされているレジストリーにイメージをプッシュします。

docker push localhost:5000/php
docker push localhost:5000/caddy
docker push localhost:5000/pwa

Deploying

Finally, deploy the project using the Helm chart:

最後に、Helm チャートを使用してプロジェクトをデプロイします。

$ helm install my-project helm/api-platform \
  --set php.image.repository=localhost:5000/php \
  --set php.image.tag=latest \
  --set caddy.image.repository=localhost:5000/caddy \
  --set caddy.image.tag=latest \
  --set pwa.image.repository=localhost:5000/pwa \
  --set pwa.image.tag=latest

Copy and paste the commands displayed in the terminal to enable the port forwarding then go to http://localhost:8080 to access your application!

ターミナルに表示されるコマンドをコピー アンド ペーストしてポート フォワーディングを有効にし、http://localhost:8080 に移動してアプリケーションにアクセスします。

Run minikube dashboard at any moment to see the state of your deployments.

いつでも minikube ダッシュボードを実行して、デプロイの状態を確認してください。