Run the following command in the project root directory to build the Docker image:
docker build -t frontend .
Push the built image to Docker Hub or another container image registry:
docker tag frontend 1098822169/frontend:latest
docker push 1098822169/frontend:latest
Create a deployment.yaml file to define the Kubernetes deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-deployment
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: 1098822169/frontend:latest
ports:
- containerPort: 80
kubectl apply -f frontend-deployment.yaml
kubectl apply -f frontend-service.yaml