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