Commit 5022030b authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

init

parent e8d9a535
FROM php:8.2-apache
COPY . /var/www/html
RUN echo "<?php echo 'Version 1.0'; ?>" > /var/www/html/version.txt
EXPOSE 80
version: "3.8"
services:
php-app:
build: .
ports:
- "8080:80"
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
shell_exec('kubectl rollout restart deployment php-app');
echo "Update requested!";
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP App</title>
</head>
<body>
<h1>Welcome to PHP App</h1>
<p>Current Version: <?php echo file_get_contents("version.txt"); ?></p>
<form method="POST">
<button type="submit">Update App</button>
</form>
</body>
</html>
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-app
labels:
app: php-app
spec:
replicas: 3
strategy:
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
selector:
matchLabels:
app: php-app
template:
metadata:
labels:
app: php-app
spec:
containers:
- name: php-app
image: myrepo/php-app:latest
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 3
periodSeconds: 5
apiVersion: v1
kind: Service
metadata:
name: php-app-service
spec:
selector:
app: php-app
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment