health docker

This commit is contained in:
Colmaris 2024-12-15 11:30:38 +01:00
parent 461af4781d
commit 16ee9579cf
8 changed files with 187 additions and 11 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View file

@ -1,19 +1,30 @@
# Dockerfile
FROM php:8.3-apache
# Apache config
COPY conf/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY conf/apache.conf /etc/apache2/conf-available/z-ambient.conf
COPY errors /errors
RUN a2enconf z-ambient
EXPOSE 80
WORKDIR /app
# Php config
HEALTHCHECK --interval=1m --timeout=3s --start-period=5s --start-interval=1s --retries=3 \
CMD curl -f http://localhost/_health || exit 1
# git, unzip & zip are for composer
RUN apt-get update -qq && \
apt-get install -qy \
git \
gnupg \
unzip \
zip \
nano
zip && \
apt-get clean && rm -rf /var/lib/apt/lists/* /var/log/*
# PHP Extensions
RUN docker-php-ext-install -j$(nproc) opcache mbstring
COPY conf/php.ini /usr/local/etc/php/conf.d/app.ini
COPY --link conf/php.ini /usr/local/etc/php/conf.d/app.ini
# Apache
COPY --link errors /errors
COPY --link health.php /health/index.php
COPY --link conf/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY --link conf/apache.conf /etc/apache2/conf-available/z-ambient.conf
COPY --link /src /app
RUN a2enmod rewrite remoteip && \
a2enconf z-ambient

20
errors/403.html Normal file
View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>Erreur 403 (Interdit)</title>
<link href="/_errors/css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="error-box">
<div id="error-image"></div>
<h1>403</h1>
<h2>Accès interdit.</h2>
<p>L'accès à cette page requiert une autorisation.</p>
<a href="/">Retour à la page d'accueil</a>
</div>
</body>
</html>

20
errors/404.html Normal file
View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>Erreur 404 (Introuvable)</title>
<link href="/_errors/css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="error-box">
<div id="error-image"></div>
<h1>404</h1>
<h2>Oops! Vous êtes perdu.</h2>
<p>La page que vous demandez est introuvable. Elle a peut-être été supprimée ou déplacée.</p>
<a href="/">Retour à la page d'accueil</a>
</div>
</body>
</html>

20
errors/500.html Normal file
View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>Erreur 500 (Inaccessible)</title>
<link href="/_errors/css/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="error-box">
<div id="error-image"></div>
<h1>500</h1>
<h2>Huston, on a un problème !</h2>
<p>La page que vous demandez est temporairement inaccessible.</p>
<a href="/">Retour à la page d'accueil</a>
</div>
</body>
</html>

102
errors/css/style.css Normal file
View file

@ -0,0 +1,102 @@
html {
box-sizing: border-box;
font-size: 16px;
}
*, *:before, *:after {
box-sizing: inherit;
}
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
margin: 0;
padding: 0;
font-weight: normal;
}
ol, ul {
list-style: none;
}
html, body {
height: 100%;
}
body {
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#error-box {
position: relative;
max-width: 560px;
width: 100%;
padding-left: 160px;
line-height: 1.1;
}
#error-box #error-image {
position: absolute;
left: 0;
top: 0;
display: inline-block;
width: 140px;
height: 140px;
background-image: url('/_errors/img/emoji.png');
background-size: cover;
}
#error-box #error-image:before {
content: '';
position: absolute;
width: 100%;
height: 100%;
transform: scale(2.4);
border-radius: 50%;
background-color: #f2f5f8;
z-index: -1;
}
#error-box h1 {
font-size: 65px;
font-weight: 700;
margin-top: 0;
margin-bottom: 10px;
color: #151723;
text-transform: uppercase;
}
#error-box h2 {
font-size: 21px;
font-weight: 400;
margin: 0 0 1rem 0;
text-transform: uppercase;
color: #151723;
}
#error-box p {
color: #999fa5;
font-weight: 400;
margin-bottom: 1rem;
}
#error-box a {
font-weight: 500;
text-decoration: none;
color: #388dbc;
}
@media only screen and (max-width: 767px) {
#error-box #error-image {
width: 110px;
height: 110px;
}
#error-box {
padding-left: 15px;
padding-right: 15px;
padding-top: 110px;
}
}

BIN
errors/img/emoji.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

3
health.php Normal file
View file

@ -0,0 +1,3 @@
<?php
http_response_code(204);