Update Deployment.yml #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Minikube | |
on: | |
push: | |
branches: | |
- main # Change this to your default branch if needed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker images | |
run: | | |
# Build the Docker images | |
docker build -t alihdr116/single-crud-nodejs-mysql-client ./client | |
docker build -t alihdr116/single-crud-nodejs-mysql-server ./server | |
# Push the images to Docker Hub | |
docker push alihdr116/single-crud-nodejs-mysql-client | |
docker push alihdr116/single-crud-nodejs-mysql-server | |
- name: Set up Minikube | |
run: | | |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | |
sudo install minikube-linux-amd64 /usr/local/bin/minikube | |
minikube start | |
- name: Enable Ingress | |
run: minikube addons enable ingress | |
- name: Deploy to Minikube | |
run: | | |
# Apply the deployment and service configurations | |
kubectl apply -f k8s/Deployment.yml | |
kubectl apply -f Service.yml | |
- name: Wait for deployments to be ready | |
run: | | |
kubectl rollout status deployment/my-app | |
- name: Expose Services | |
run: | | |
# Expose the Node.js server and React client services | |
minikube service server-service --url | |
minikube service client-service --url |