improve link
parent
481e9acf55
commit
c63dea7db3
|
@ -24,55 +24,54 @@ for more information checkout github actions marketplace :[setup-minikube](https
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
- a valid Dockerfile
|
- a valid Dockerfile
|
||||||
- a valid deployment.yaml (make sure image pull policy is set to never see bellow for example
|
- a valid deployment.yaml to deploy image to kubernetes (make sure image pull policy is set to never see [bellow](/#deployment.yaml used in the example) for example)
|
||||||
|
|
||||||
Steps:
|
Steps:
|
||||||
|
|
||||||
- Copy the wokryaml to `.github/workflows/pr.yml` in your github repo.
|
- Create a workflow yaml in your github repo in `.github/workflows/pr.yml`
|
||||||
- Make a PR to your repo and see the result in github actions.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: CI
|
name: CI
|
||||||
on:
|
on:
|
||||||
- pull_request
|
- pull_request
|
||||||
jobs:
|
jobs:
|
||||||
job1:
|
job1:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: build example and deploy to minikbue
|
name: build example and deploy to minikbue
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Start minikube
|
- name: Start minikube
|
||||||
uses: medyagh/setup-minikube@master
|
uses: medyagh/setup-minikube@master
|
||||||
- name: Try the cluster !
|
- name: Try the cluster !
|
||||||
run: kubectl get pods -A
|
run: kubectl get pods -A
|
||||||
- name: Build image
|
- name: Build image
|
||||||
run: |
|
run: |
|
||||||
export SHELL=/bin/bash
|
export SHELL=/bin/bash
|
||||||
eval $(minikube -p minikube docker-env)
|
eval $(minikube -p minikube docker-env)
|
||||||
docker build -f ./Dockerfile -t local/example .
|
docker build -f ./Dockerfile -t local/example .
|
||||||
echo -n "verifying images:"
|
echo -n "verifying images:"
|
||||||
docker images
|
docker images
|
||||||
- name: Deploy to minikube
|
- name: Deploy to minikube
|
||||||
run:
|
run:
|
||||||
kubectl apply -f deploy-to-minikube.yaml
|
kubectl apply -f deploy-to-minikube.yaml
|
||||||
- name: Test service URLs
|
- name: Test service URLs
|
||||||
run: |
|
run: |
|
||||||
minikube service list
|
minikube service list
|
||||||
minikube service example --url
|
minikube service example --url
|
||||||
echo "------------------opening the service------------------"
|
echo "------------------opening the service------------------"
|
||||||
curl $(minikube service example --url)/version
|
curl $(minikube service example --url)/version
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, the above workflow yaml, will do the following steps on each coming PR:
|
In this example, the above workflow yaml, will do the following steps on each coming PR:
|
||||||
|
|
||||||
1- Checks out the the source code
|
1. Checks out the the source code
|
||||||
2- Installs and starts minikube
|
2. Installs & starts minikube
|
||||||
3- Trying out the cluster just by running kubectl get pods -A
|
3. Tries out the cluster just by running `kubectl` command
|
||||||
4- Build the docker image using minikube's docker-env feature
|
4. Build the docker image using minikube's docker-env feature
|
||||||
5- Apply the yaml deployment yaml file minikube
|
5. Apply the yaml deployment yaml file minikube
|
||||||
6- Check the service been created in minikube
|
6. Check the service been created in minikube
|
||||||
|
|
||||||
### example deployment yaml for minikube
|
### deployment.yaml used in the example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
|
|
Loading…
Reference in New Issue