Compare commits
2 Commits
f06c804c24
...
8af61f97b0
Author | SHA1 | Date | |
---|---|---|---|
8af61f97b0 | |||
f75be1fcaf |
@ -13,6 +13,9 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
# Activeer mod_rewrite
|
||||
RUN a2enmod rewrite
|
||||
|
||||
# Installeer git
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y git
|
||||
|
||||
# Installeer de Process Control extension
|
||||
RUN curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s pcntl zip
|
||||
|
||||
|
12
index.php
12
index.php
@ -6,6 +6,18 @@ if($_SERVER["REQUEST_URI"] == '/metrics') {
|
||||
$phpbin = getenv('PHP_BINARY');
|
||||
$output = shell_exec('CONFIG_FILE="' . $config . '" ' . $phpbin . ' ' . $_SERVER['DOCUMENT_ROOT'] . 'script.php');
|
||||
echo $output;
|
||||
} elseif ($_SERVER["REQUEST_URI"] == '/config') {
|
||||
header('Content-Type: application/json');
|
||||
require_once getenv('CONFIG_FILE');
|
||||
echo json_encode($config);
|
||||
} elseif ($_SERVER["REQUEST_URI"] == '/version') {
|
||||
header('Content-Type: application/json');
|
||||
$git = [
|
||||
'lastCommit' => trim(shell_exec('git rev-parse HEAD')),
|
||||
'lastCommitTimestamp' => trim(shell_exec('git log -1 --format=%cd')),
|
||||
'branch' => trim(shell_exec('git rev-parse --abbrev-ref HEAD')),
|
||||
];
|
||||
echo json_encode($git);
|
||||
} else {
|
||||
require_once('vendor/autoload.php');
|
||||
http_response_code(404);
|
||||
|
@ -8,5 +8,7 @@
|
||||
<body>
|
||||
<h1>404 Uri {{ path }} not found</h1>
|
||||
<p><a href="/metrics">/metrics</a></p>
|
||||
<p><a href="/config">/config</a></p>
|
||||
<p><a href="/version">/version</a></p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user